--- In c-prog@yahoogroups.com, Ravi Mishra ravics...@... wrote:
Please help me and provide your suggetion for finding the cause of crash
dump.
Suggestions:
1. Put comments in your code. Then we (and you) might all have a better chance
of understanding what the code is doing.
2. Use the
--- In c-prog@yahoogroups.com, John Matthews jm5...@... wrote:
--- In c-prog@yahoogroups.com, Ravi Mishra ravicse04@ wrote:
Please help me and provide your suggetion for finding the cause of crash
dump.
Suggestions:
4. Your MacCommon type appears to contain 2 arrays, both indexed
--- In c-prog@yahoogroups.com, John Matthews jm5...@... wrote:
Suggestions:
6. Does timerStartInst_ms() take a void* argument in the 4th parameter? If so,
then you should not be casting to void* (assuming you are using a C compiler) -
no cast is required, and adding one just complicates
--- In c-prog@yahoogroups.com, John Matthews jm5...@... wrote:
--- In c-prog@yahoogroups.com, John Matthews jm5678@ wrote:
5. Your code is made more difficult to understand (and hence maintain/debug)
by the length of the lines. You should use pointers - combined with the
typedef in (4
--- In c-prog@yahoogroups.com, Uday Oberio uday_obe...@... wrote:
i have one question that is
float a=1.1;
double b=1.1;
if(a==b)
printf(hello);
else
printf(how are u );
now tell me which part will be executed and why ?
Paul's link gives the full answer, but in simple terms there
--- In c-prog@yahoogroups.com, peternilsson42 peternilsso...@... wrote:
I have used 8MB implementations where int was still only
16-bit. I dare say there are some embedded environments
where this is still the case.
Yep.
You could argue that size_t may have performance issues
because it is
--- In c-prog@yahoogroups.com, Anusha K una_...@... wrote:
Is QA (quality assurance/testing) job better than development job .. or
vice-versa pls tell me??
Surely that largely depends on which you prefer doing. Or don't you have a
preference?
--- In c-prog@yahoogroups.com, Christopher Coale chris95...@... wrote:
double Sma(double *ds, int size)
A slight improvement is:
double Sma(const double *ds, int size)
The const tells the compiler and the reader that the function isn't supposed to
modify the data at ds; it is 'constant'. For
--- In c-prog@yahoogroups.com, Bill Cunningham bill...@... wrote:
I would like to start writing code and calling functions in C
code with a pointer to a function. This so I can learn
functions pointers.
Simple example:
#include stdio.h
static void inc(int *p) /* increment */
{
(*p)++;
--- In c-prog@yahoogroups.com, Ravi Mishra ravics...@... wrote:
for (delIndex = rachQIndex; delIndex rachTxQueue-n; delIndex++) {
rachTxQueue-queue[(delIndex + rachTxQueue-start) %
(petMaxUEInstancePerProcess+1)]
= rachTxQueue-queue[(delIndex + rachTxQueue-start + 1) %
--- In c-prog@yahoogroups.com, John Matthews jm5...@... wrote:
--- In c-prog@yahoogroups.com, Ravi Mishra ravicse04@ wrote:
for (delIndex = rachQIndex; delIndex rachTxQueue-n; delIndex++) {
rachTxQueue-queue[(delIndex + rachTxQueue-start) %
(petMaxUEInstancePerProcess+1
--- In c-prog@yahoogroups.com, John Matthews jm5...@... wrote:
Also, rachQIndex should *not* be incremented at the end of the loop if the UE
is deleted
...or should there just be a break to exit the loop when the UE is deleted?
--- In c-prog@yahoogroups.com, Sudipta Deb dsudipta.1...@... wrote:
How can i print parent's PID from child's and vice versa.
int main(void)
{
pid_t pidParent, pidChild = fork();
const char *who;
if (pidChild == 0)
{
who = child;
pidChild =
--- In c-prog@yahoogroups.com, John Matthews jm5...@... wrote:
#include stdio.h
#include sys/types.h
#include unistd.h
int main(void)
{
:
--- In c-prog@yahoogroups.com, peternilsson42 peternilsso...@... wrote:
--- In c-prog@yahoogroups.com, John Matthews jm5678@ wrote:
peternilsson42 peternilsson42@ wrote:
I haven't seen a system where this will seriously fail,
but I prefer...
printf(reg = %u\n, 0u + *reg
--- In c-prog@yahoogroups.com, Sharma, Hans Raj \(London\)
hansraj_sha...@... wrote:
Can someone please help me understand how can I write a program which,
using volatile variable, access some memory mapped devices?
If you have an 8 bit register at address 0x1234 containing an unsigned 8 bit
--- In c-prog@yahoogroups.com, John Matthews jm5...@... wrote:
--- In c-prog@yahoogroups.com, Sharma, Hans Raj \(London\)
hansraj_sharma@ wrote:
Can someone please help me understand how can I write a program which,
using volatile variable, access some memory mapped devices
--- In c-prog@yahoogroups.com, Sharma, Hans Raj \(London\)
hansraj_sha...@... wrote:
Just one doubt, are you talking about CPU
registers below? Can we get address of them? How?
I was talking about registers in your memory mapped device; you have to know
the memory location of your memory
--- In c-prog@yahoogroups.com, iamwljiang iamwlji...@... wrote:
you will know macro swap(a,b) just execute temp = a; behind this not execute.
temp = a; is the only bit of the macro that isn't executed for the given values
of i and j; it's a=b;b=temp; that is executed:
a=b = i=j = i=10
b=temp
--- In c-prog@yahoogroups.com, peternilsson42 peternilsso...@... wrote:
I haven't seen a system where this will seriously fail,
but I prefer...
printf(reg = %u\n, 0u + *reg);
Haven't seen that before - thanks.
--- In c-prog@yahoogroups.com, piyush_4love_4ever piyush_4love_4e...@...
wrote:
using TerboC/C++
# define swap(a,b)temp=a;a=b;b=temp;
void main()
{
int i=5,j=10,temp=0;
if(ij) swap(i,j);
This is the same as:
if (i j)
temp = i;
i = j;
j = temp;
--- In c-prog@yahoogroups.com, iamwljiang iamwlji...@... wrote:
don't forget ()
#define swap(a,b) (temp=a;a=b;b=temp;)
That doesn't compile.
See http://tech.groups.yahoo.com/group/c-prog/message/70718
--- In c-prog@yahoogroups.com, Sharma, Hans Raj (London) hansraj_sha...@...
wrote:
Proper way of defining
# define swap(a,b){temp=a;a=b;b=temp;}
No it isn't - the following doesn't compile:
if (i j) swap(i, j); else printf(no swap\n);
You could put do .. while (0) outside the braces,
--- In c-prog@yahoogroups.com, tan_backagain tan_backag...@... wrote:
--- In c-prog@yahoogroups.com, piyush_4love_4ever piyush_4love_4ever@
wrote:
using TerboC/C++
# define swap(a,b)temp=a;a=b;b=temp;
TANMAY::
Just add braces
#define swap(a,b) {temp=a;a=b;b=temp;}
--- In c-prog@yahoogroups.com, John Matthews jm5...@... wrote:
or add an else after the closing brace (although that can result in an 'empty
else' compiler warning from gcc)
Sorry- ignore that; I was thinking of situations where the 'if' is inside macro.
--- In c-prog@yahoogroups.com, John Matthews jm5...@... wrote:
--- In c-prog@yahoogroups.com, John Matthews jm5678@ wrote:
or add an else after the closing brace (although that can result in an
'empty else' compiler warning from gcc)
Sorry- ignore that; I was thinking of situations
--- In c-prog@yahoogroups.com, WLJiang WLJiang iamwlji...@... wrote:
O,the right is #define swap(a,b) {temp=a; a=b; b=temp;}
No it isn't - see previous posts.
--- In c-prog@yahoogroups.com, Olufowobi Lawal wolex...@... wrote:
So that left me wondering if recursion is in same category as goto , know
it, but don't use it.
or are there some instance or some way where they can be used effeciently,
like in my case?
I don't think your case is a good
--- In c-prog@yahoogroups.com, Ahmed Mahmoud eng_hamada2...@... wrote:
You are right but if you read my message you will find that i substituted
with m=5 so i got this
If you replace the variable with a number in the C code, it isn't a valid
expression. If you assign the number to the
--- In c-prog@yahoogroups.com, Ahmed Mahmoud eng_hamada2...@... wrote:
i hope you read them -this is true as i tried them many times if you have
another opinion illustrate it
In the expression:
v=(m++)+(++m);
the value of v depends on the order of evaluation. Therefore the result is
--- In c-prog@yahoogroups.com, Arvind Balodia arvind.balo...@... wrote:
v=(m++)+(++m);
if it is against the rule of c language then the all the compilers
that have been developed should leave a message telling the User
that it is against the programming laws.
g++ does give a warning:
--- In c-prog@yahoogroups.com, Steve Searle st...@... wrote:
Around 06:59am on Thursday, May 28, 2009 (UK time), John Matthews scrawled:
As does (f)lint:
Is this a free version of lint? If so, where do you get it from?
Sorry - flint is the executable name of Gimpel's FlexeLint.
http
--- In c-prog@yahoogroups.com, Jos Timanta Tarigan jos_t_tari...@... wrote:
hi,
im currently having a problem try to calculate this:
directionZ = -cos((angleX+90)*PI_RADIAN);
most of the time it works but when im in the boundary of the coordinate, it
gives me a little error that im not
--- In c-prog@yahoogroups.com, Paul Herring pauljherr...@... wrote:
[...@pjhxps ~]# locate stdio.h
I wish you'd told me about that 2 years ago when I started doing linux - would
have saved a lot of time fiddling around with find :-)
--- In c-prog@yahoogroups.com, Paul Herring pauljherr...@... wrote:
On Tue, May 19, 2009 at 11:42 AM, John Matthews jm5...@... wrote:
--- In c-prog@yahoogroups.com, Paul Herring pauljherring@ wrote:
[...@pjhxps ~]# locate stdio.h
I wish you'd told me about that 2 years ago when I
--- In c-prog@yahoogroups.com, Nicle yni...@... wrote:
I have a file 2GB, and my job is seeking the file to pos: 2.1G.
But, the lseek doesn't work.
Try lseek64()?
--- In c-prog@yahoogroups.com, Paul Herring pauljherr...@... wrote:
On Thu, May 14, 2009 at 5:32 PM, Rick mowgl...@... wrote:
If you work with embedded or real-time systems, hand-coding may still
be important
Not in the two (distinctly different[1]) industries I've been working
in over
--- In c-prog@yahoogroups.com, mikejd42 mikej...@... wrote:
--- In c-prog@yahoogroups.com, John Matthews jm5678@ wrote:
newPixel = (pixel1 + pixel2) / 2;
instead of the /2 use 1 its faster with less overhead.
The compiler will generate code that effectively does 1 to implement
--- In c-prog@yahoogroups.com, Jos Timanta Tarigan jos_t_tari...@... wrote:
i dont know if i coded it wrong. plus working properly but the /2.0 return
always zero.
Should be / 2, not 2.0. Can you show us your code?
--- In c-prog@yahoogroups.com, mikejd42 mikej...@... wrote:
--- In c-prog@yahoogroups.com, John Matthews jm5678@ wrote:
--- In c-prog@yahoogroups.com, mikejd42 mikejd42@ wrote:
--- In c-prog@yahoogroups.com, John Matthews jm5678@ wrote:
newPixel = (pixel1 + pixel2) / 2
--- In c-prog@yahoogroups.com, mikejd42 mikej...@... wrote:
newpixel = ( pixel1 + pixel2 ) 1;
This is hard to understand?
Harder than:
newpixel = (pixel1 + pixel2) / 2;
because I (and I think others) would think - why are we using a bit shift here?
Are the pixels bit masks or
--- In c-prog@yahoogroups.com, Thomas Hruska thru...@... wrote:
I try to not pull the 'x' years of experience card out too often.
Yes, it trumps everything (assuming the person actually has more years
of experience) but should only be pulled out as the last resort. I get
to win the
--- In c-prog@yahoogroups.com, mikejd42 mikej...@... wrote:
Your correct Tom. Too much nit-picking.
You started it! :-)
--- In c-prog@yahoogroups.com, Tiba industry jm5...@... wrote:
Tiba industry
Nothing to do with me, and I'm in Linux so I don't think I've been infected.
Just someone putting my address in the 'from' field.
--- In c-prog@yahoogroups.com, Jos Timanta Tarigan jos_t_tari...@... wrote:
the problem is i want to merge two image and merging the value of each pixel.
so basically pixel1 + pixel2 / 2.0;
the problem is each of these pixels is char. how can I convert it to float
and then convert it back
--- In c-prog@yahoogroups.com, John Matthews jm5...@... wrote:
--- In c-prog@yahoogroups.com, Jos Timanta Tarigan jos_t_tarigan@ wrote:
the problem is i want to merge two image and merging the value of each
pixel. so basically pixel1 + pixel2 / 2.0;
the problem is each of these pixels
--- In c-prog@yahoogroups.com, abcpqr70 abcpq...@... wrote:
--- In c-prog@yahoogroups.com, Stephane Lesoinne lesoinne@ wrote:
If you want to convert a string representation of a number to his
integer equivalent, you'll have to use the atoi(...) function.
yeah!
even i have same
--- In c-prog@yahoogroups.com, Paul Herring pauljherr...@... wrote:
On Thu, May 7, 2009 at 12:53 PM, Tyler Littlefield ty...@... wrote:
that's what I was talking about.
No you weren't. Or if you were, you didn't express it correctly.
See also
--- In c-prog@yahoogroups.com, Jos Timanta Tarigan jos_t_tari...@... wrote:
so im currently try to read a binary file and try to represent it in rgb
image. i save the file into char[length] and then try to convert it to int to
get 0-255 value. is it ok to do it explicitly eg. (int)thisChar ?
--- In c-prog@yahoogroups.com, Thomas Hruska thru...@... wrote:
Bill Cunningham wrote:
Does anyone know what the looping constructs are that are used in
command line interfaces that use a switch such as -d or -a in their argv?
The POSIX approach is to use getopt().
Example:
--- In c-prog@yahoogroups.com, Thomas Hruska thru...@... wrote:
I've been rejecting a number of messages for being unprofessional.
Some of the replies from regular contributors to this forum have been very
unprofessional. I think it should work both ways - an unprofessional question
doesn't
--- In c-prog@yahoogroups.com, Tyler Littlefield ty...@... wrote:
the array gets deleted, but I could shift that over to a
real array rather than on the heap, might help somewhat.
It's not a performance issue, just a matter of principle and using the right
construct for the job. If you don't
--- In c-prog@yahoogroups.com, Tyler Littlefield ty...@... wrote:
Server::~Server()
{
if (users.size() )
{
unsigned int count=0;
for ( count=0;count ( users.size() +1 );count++ )
{
delete users[count];
}
Haven't examined it in detail (C++
Mathematical integration - area under a curve?
--- In c-prog@yahoogroups.com, Rick rdo...@... wrote:
I'm a little confused about how, when, (if) scientific notation gets used.
Are you talking about printf conversion specifiers, namely %g? If so, the
manual says:
Style e [scientific] is used if the exponent from its conversion is less than
--- In c-prog@yahoogroups.com, Pedro Izecksohn izecks...@... wrote:
I found that static data is executable on some platform.
FYI CentOS 5 (linux):
Compiled with gcc version 4.1.
Now I'll try to overwrite the beginning of main (int, char **).
It caused a SIGSEGV. Continuing.
Now I'll try to
--- In c-prog@yahoogroups.com, Pedro Izecksohn izecks...@... wrote:
There is no reason for a constant string not be executable.
...unless program memory and data memory are physically separate (Harvard
architecture) eg. my company's chips:
--- In c-prog@yahoogroups.com, John Matthews jm5...@... wrote:
--- In c-prog@yahoogroups.com, Tyler Littlefield tyler@ wrote:
I'm building modules in separate directories, so I have something like:
O_FILES= module1/file1.o, MODULE2/file2.o
then I have:
O_FILES_A = file1.o file2.o
--- In c-prog@yahoogroups.com, Tyler Littlefield ty...@... wrote:
I'm building modules in separate directories, so I have something like:
O_FILES= module1/file1.o, MODULE2/file2.o
then I have:
O_FILES_A = file1.o file2.o
for the linking.
Is there a way I can do this with one line?
There's
--- In c-prog@yahoogroups.com, Bill Cunningham bill...@... wrote:
- Original Message -
From: John Matthews jm5...@...
Have you looked at lex/yacc (or their modern equivalents)?
flex too
That's what I meant by 'modern equivalents' - typically (AFAIK) flex for lex
and bison
--- In c-prog@yahoogroups.com, qzqiang917 qzqiang...@... wrote:
--- In c-prog@yahoogroups.com, John Matthews jm5678@ wrote:
Have you tried using the VC debugger?
Yes,but cannot pass
Sorry - I don't understand what you mean by 'cannot pass'.
If you try single-stepping through your code
--- In c-prog@yahoogroups.com, Sri linkto...@... wrote:
just wanted to know that if there are some more efficient ways to any other
scripting languages like perl/python.
Have you looked at lex/yacc (or their modern equivalents)? Eg.
http://epaperpress.com/lexandyacc/
More of a library than a
--- In c-prog@yahoogroups.com, qzqiang917 qzqiang...@... wrote:
Dear you,
I'm sorry that I can't understand you well becanse I use XP. I have never
used Linux before.When I use Vc 6.0 to complier the program,it always gets
the errror: Access Violation.
Have you tried using the VC debugger?
--- In c-prog@yahoogroups.com, piyush_4love_4ever piyush_4love_4e...@...
wrote:
i want to know in which language , the c-compiler is written first
http://www.livinginternet.com/i/iw_unix_c.htm
--- In c-prog@yahoogroups.com, qzqiang917 qzqiang...@... wrote:
for(i = 0; i length; i++)
k[i] = scanf(%d);
If you are using Linux and compile this using gcc -Wall, you get a warning for
the scanf():
warning: too few arguments for format
Presumably it should be:
--- In c-prog@yahoogroups.com, Csaba Zvekan czve...@... wrote:
The problem that I was having was while porting from Basic to C got me
confused . I didn't know how to state the else command .
Sorry, I should have said that my question wasn't anything to do with your
'else' question - I just
--- In c-prog@yahoogroups.com, kathir resh resh_perso...@... wrote:
main()
{
char *p=hai friends,*p1;
p1=p;
while(*p!='\0')
++*p++;
printf(%s%s,p,p1);
}
output ibj!gsjfoet
please explain it..
what is the difference between ++*p and p++whether here ++*p means
--- In c-prog@yahoogroups.com, Thomas Hruska thru...@... wrote:
Tamas Marki, Andrew Clarke, John Gaughan, and John Matthews are at the
top of my list of possible candidates (if they are interested).
Thomas- I'm flattered, but to be honest I spend more (work) time than I should
on this list
--- In c-prog@yahoogroups.com, Tyler Littlefield ty...@... wrote:
Hello list,
I've got a quick question;
I'm using ctime for logs, and want to cut down on it somewhat, so it won't
show the date. Maybe just something that will show like 3 hours 5 minutes
ago, or something similar, or
--- In c-prog@yahoogroups.com, Satya Prasad satya_prakash_pra...@... wrote:
Is it safe to refer same variables in LHS and RHS while using Bitwise
operators. Like:
int x = 0 ;
int y = 0;
x = x | y;
Yes, that is safe. Perhaps you are thinking of expressions such as:
x = x++ | y;
which
--- In c-prog@yahoogroups.com, Tyler Littlefield ty...@... wrote:
But the following does the same thing and is also safe, and is what I think
you should use:
it doesn't really matter, just makes it quicker coding. :)
I realise that the generated code is probably identical, but if a language
--- In c-prog@yahoogroups.com, pearlprist...@... pearlprist...@... wrote:
hai friends
i am not comfortable with using linked lists and pointer but i wish
to learn these topics.
can anyboby help with some notes or programs about these???
and their applications too.
please explain the
--- In c-prog@yahoogroups.com, rizwannu rizwa...@... wrote:
can any one give me asimple c program for climate control system using file
handling
You are more likely to get help if you have a go at writing the program
yourself, and ask for help when you get stuck. If you are having trouble
--- In c-prog@yahoogroups.com, Ahmed Shabana unlimited...@... wrote:
can any one till me exactly what is this
?
http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Designated-Inits.html
--- In c-prog@yahoogroups.com, Brett McCoy idragos...@... wrote:
mutexes are used on Unix-ish systems, too, although it's easy enough
to iterate across the process list even with a shell script.
Never tried it, but is there a danger with the process list approach (Windows
or Unix) that if 2
--- In c-prog@yahoogroups.com, John Matthews jm5...@... wrote:
--- In c-prog@yahoogroups.com, Brett McCoy idragosani@ wrote:
mutexes are used on Unix-ish systems, too, although it's easy enough
to iterate across the process list even with a shell script.
Never tried
--- In c-prog@yahoogroups.com, peternilsson42 peternilsso...@... wrote:
% fact 1000
4023872600770937735437024339230039857193748642107146325437999104
2993851239862902059204420848696940480047998861019719605863166687
2994808558901323829669944590997424504087073759918823627727188732
...
--- In c-prog@yahoogroups.com, ruhatadiyaman ruhatadiya...@... wrote:
i want to clean screen in somewhere of my codes but 'clrscr()' does not work
with #includeconio.h . as i search it does not work in DEVC++(bloodshed).
and i saw the system(cls) function which is declared in stdlib and it
--- In c-prog@yahoogroups.com, ruhatadiyaman ruhatadiya...@... wrote:
thanks for all replies. i tried them but still the problem
is continuing. this is my code with 'unsigned long int';
If you just use double for your fak variable, you end up with this, which works
for me (gcc):
--- In c-prog@yahoogroups.com, John Matthews jm5...@... wrote:
--- In c-prog@yahoogroups.com, ruhatadiyaman ruhatadiyaman@ wrote:
thanks for all replies. i tried them but still the problem
is continuing. this is my code with 'unsigned long int';
If you just use double for your fak
--- In c-prog@yahoogroups.com, rajatsaini4u rajatsain...@... wrote:
Here is my program in Turboc compiler(problem is described below it)
sum=sum+s*pow(2,i);
Instead of using pow(), which is a floating point function, it would be better
to use:
sum += s * (1 i);
--- In c-prog@yahoogroups.com, andrew clarke m...@... wrote:
On Sat 2009-03-14 14:08:58 UTC-, John Matthews (jm5...@...) wrote:
Sorry - I left out the getch(), because on linux it comes from the
curses library. If you need to wait for a key press, it might be
better to use a stdio.h
--- In c-prog@yahoogroups.com, ruhatadiyaman ruhatadiya...@... wrote:
i wrote a code which calculates the factorials of 1-20. it gives the correct
result until 13 but it is not correct after 13.
Because 13! 2^31. That is, the int type is not big enough to hold the answer.
Try using long or
--- In c-prog@yahoogroups.com, peternilsson42 peternilsso...@... wrote:
However main() is
optimised effectively to a no-op since the compiler
was able to recognise that foo(i) will indeed equal
bar(i) for the iterated values of i!
I'm not disputing the evidence, but I'm very surprised it can
--- In c-prog@yahoogroups.com, John Matthews jm5...@... wrote:
--- In c-prog@yahoogroups.com, peternilsson42 peternilsson42@ wrote:
However main() is
optimised effectively to a no-op since the compiler
was able to recognise that foo(i) will indeed equal
bar(i) for the iterated values
--- In c-prog@yahoogroups.com, praveen indian85 praveen_india...@... wrote:
dec=dec+temp*pow(2,i);
pow() takes double arguments and returns a double. The following would be more
appropriate:
dec += temp * (1 i);
BTW is (int)pow(2, i) guaranteed to return the same as (1 i) for
--- In c-prog@yahoogroups.com, Michael Comperchio mcmp...@... wrote:
he did say he was accepting strings
can't accept a string without a second buffer :)
#include stdio.h
#include string.h
#define BUFSZ 1000
int main(void)
{
char buffer[BUFSZ], *s;
size_t len;
for (*(s = buffer)
--- In c-prog@yahoogroups.com, rasheed abdul rashu_76...@... wrote:
Dear Sir,
While using cos( ) function to find the cos value of 30, 60, 90, 120,
130, 150,.. etc.. in C , the output is coming wrongly
The expect the argument in radians, not degrees.
--- In c-prog@yahoogroups.com, mina mina_sa2...@... wrote:
how is hardware supporting for static type checking?
Please could you clarify - what do you mean by 'hardware'?
--- In c-prog@yahoogroups.com, Michael Comperchio mcmp...@... wrote:
anyway, 'tis better to be zeroed and sure, than to never
have zeroed at all.
Michael- I agree that defensive programming is A Good Idea, but in general I
don't think initialising things 'just in case' is the best
--- In c-prog@yahoogroups.com, John Matthews jm5...@... wrote:
--- In c-prog@yahoogroups.com, Michael Comperchio mcmprch@ wrote:
anyway, 'tis better to be zeroed and sure, than to never
have zeroed at all.
Michael- I agree that defensive programming is A Good Idea
BTW bug
--- In c-prog@yahoogroups.com, Michael Comperchio mcmp...@... wrote:
Would lint have caught my silly typo?
It does detect attempts to access beyond the end of arrays it knows the size
of, but unfortunately in this case it doesn't know the size of argv[].
I take it you haven't used PC-Lint (or
--- In c-prog@yahoogroups.com, Michael Comperchio mcmp...@... wrote:
and of course, no compiler or tool can check access of the end of
arrays I think :)
static int table[] = {1, 2, 3, 4, 5};
int main(void)
{
int i, sum;
for (sum = i = 0; i = 5; i++)
{
sum +=
--- In c-prog@yahoogroups.com, Michael Comperchio mcmp...@... wrote:
Ok, now I remember why i don't have it at home PC-Lint, one
workstation license - $389 us.
Yes - pity it's so expensive for personal have-a-play type use, but as I said
in
--- In c-prog@yahoogroups.com, Paul Herring pauljherr...@... wrote:
On Thu, Mar 5, 2009 at 4:27 PM, Michael Comperchio mcmp...@... wrote:
memset( buffer, 1000, 0);
strcat(buffer, first_text);
strcat(buffer, second_text);
workable
although
strcpy(buffer, first_text);
strcat(buffer,
--- In c-prog@yahoogroups.com, Paul Herring pauljherr...@... wrote:
http://c-faq.com/null/machnon0.html
Don't rely on NULL being all bits zero.
Sorry Paul - I don't see the bit that tells me whether static initialisation to
0 means that pointers are set
- to NULL independent of the internal
--- In c-prog@yahoogroups.com, peternilsson42 peternilsso...@... wrote:
But to answer your question, 6.7.8p10:
...If an object that has static storage duration is
not initialized explicitly, then:
- if it has pointer type, it is initialized to a
null pointer; ...
Thanks,
--- In c-prog@yahoogroups.com, Michael Sullivan msulli1...@... wrote:
The array index was the problem. I had numbered them 1-4. That's a
beginner's mistake. It does what I wanted it to now.
I don't know how much programming you do, but if you can afford it (or
can persuade your employer to
--- In c-prog@yahoogroups.com, John Matthews jm5...@... wrote:
Gimpel's PC-Lint is
great at spotting things like that, and a whole lot more:
http://www.gimpel.com/
Wow- I've seen how much it costs now. Last time I looked it was about
£100, now it's £346! Definitely something you ask your
--- In c-prog@yahoogroups.com, Brett McCoy idragos...@... wrote:
There are free (open source) versions of Lint for Windows also, like
splint:
I did play with splint for a while, and although of course it's better
than nothing, I would say that PC-Lint is worth the money. Especially
if you can
1 - 100 of 299 matches
Mail list logo