[Gllug] My and my malloc() problems....

Daniel Clusells dclusells at terra.es
Fri Dec 28 16:14:34 UTC 2001


Hi All,

Although I'm a little bit out of practice I think of C as my first language.
I think I can give you a hint about that problem.

You probably  need to use 'volatile' in some variable. For example:
1.- c=1;
2.- {code}
3.- c=2;

If you don't use directly the variable c in the block 2 the compiler
optimizes the code deleting de line 1. To avoid this you must declare the
variable 'c' as volatile.
When you use -g to compile it doesn't optimize the code and for that reason
it works.

I think. Shortly I'll revise some knowledge but the use of 'volatile' is
something not normal (in embebbed C is commonly used I think).

Cheers.

Daniel Clusells
dclusells at terra.es


-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list