Hi, On Tue, 18 Jan 2000, David Thompson wrote:
>I'm starting to clean up the libdx code as mentioned in an earlier >statement. I have found some real oddities and would like someone to >explain some things if they could. I know "C" and "C++" but I'm not sure >about some of the syntax that the compiler is also questioning. For >example, in message.c line 171 the following exists. > >static char _ErrorMessage[2000] = { NULL }; This looks like an array initialization to me. I'm not familiar with the code, but is it possible that they have undef'ed NULL and then redefined it to say 0. #undef NULL #define NULL 0 In this case the _ErrorMessage is simply a null terminated empty string. >What the hey? A static char array is going to have an address (you don't >want that address as NULL). I think what they are trying to do is say >start it out initialized as something, but what? If you want the whole >array initialized to something, how exactly would you do that (I've >always used calloc). >As I clean things up, I'm getting more and more core dumps. I think that >there is definitely some memory problems with this code. At some places, >I'm suprised that it compiles and runs. Its as if the functions were >almost written and then used. One place that does have me really >concerned is in memory.c. I get the following warnings from the >compiler: > >memory.c: In function `getfree': >memory.c:647: warning: statement with no effect >memory.c: In function `getpool': >memory.c:669: warning: statement with no effect >memory.c: In function `amalloc': >memory.c:819: warning: statement with no effect >memory.c:822: warning: statement with no effect >memory.c:833: warning: statement with no effect >memory.c:841: warning: statement with no effect >memory.c: In function `afree': >memory.c:858: warning: statement with no effect > >If you look at those statements, they are trying to increment some kind >of counter (ie I think its the memory used, etc.) But the compiler is >telling me that this isn't happening (eeeeooooowww!!) Somebody please >look at this code and tell me why?! Whenever I've seen these they've indicated that I've mistyped something and it's a bug. For example the line j+1; instead of j+=1; will result in this type of error. Tom