R
robin.bruce
Hi guys,
I just tried to give advice to a colleague who has a problem program in
C, and I was interested to hear the thoughts of this forum on the
subject.
I've been an occasional programmer in C for about a year now, so by no
means an expert, so it would be good to know if I'm leading my
colleague down the wrong path.
The error he's having is fairly obscure and relates to our own function
calls communicating with our own hardware, so I won't go into details.
Basically, does this sound like a reasonable thing to say:
I noticed that my colleague was declaring local arrays on the stack,
and also that he had a number of global variables and even a global
array on the stack. The arrays on the stack total less than 64k
(win32). The global array is only a few k. I said that in my mind, it
was just plain bad practice to have a globally declared array and to
have arrays declared on the stack. I told him to redo the whole thing
with pointers, malloc() and free and then see if the problems vanish.
Does this seem a reasonable thing to advise or am I, as I suspect my
colleague believes, just being pedantic and splitting hairs?
Cheers,
Robin
I just tried to give advice to a colleague who has a problem program in
C, and I was interested to hear the thoughts of this forum on the
subject.
I've been an occasional programmer in C for about a year now, so by no
means an expert, so it would be good to know if I'm leading my
colleague down the wrong path.
The error he's having is fairly obscure and relates to our own function
calls communicating with our own hardware, so I won't go into details.
Basically, does this sound like a reasonable thing to say:
I noticed that my colleague was declaring local arrays on the stack,
and also that he had a number of global variables and even a global
array on the stack. The arrays on the stack total less than 64k
(win32). The global array is only a few k. I said that in my mind, it
was just plain bad practice to have a globally declared array and to
have arrays declared on the stack. I told him to redo the whole thing
with pointers, malloc() and free and then see if the problems vanish.
Does this seem a reasonable thing to advise or am I, as I suspect my
colleague believes, just being pedantic and splitting hairs?
Cheers,
Robin