Next: C++ Misunderstandings, Previous: Standard Libraries, Up: Trouble [Contents][Index]
These problems are perhaps regrettable, but we don’t know any practical way around them.
This occurs because sometimes GCC optimizes the variable out of existence. There is no way to tell the debugger how to compute the value such a variable “would have had”, and it is not clear that would be desirable anyway. So GCC simply does not mention the eliminated variable when it writes debugging information.
You have to expect a certain amount of disagreement between the executable and your source code, when you use optimization.
int foo (struct mumble *); struct mumble { … }; int foo (struct mumble *x) { … }
This code really is erroneous, because the scope of struct
mumble
in the prototype is limited to the argument list containing it.
It does not refer to the struct mumble
defined with file scope
immediately below—they are two unrelated types with similar names in
different scopes.
But in the definition of foo
, the file-scope type is used
because that is available to be inherited. Thus, the definition and
the prototype do not match, and you get an error.
This behavior may seem silly, but it’s what the ISO standard specifies.
It is easy enough for you to make your code work by moving the
definition of struct mumble
above the prototype. It’s not worth
being incompatible with ISO C just to avoid an error for the example
shown above.
If you care about controlling the amount of memory that is accessed, use volatile but do not use bit-fields.
If new system header files are installed, nothing automatically arranges
to update the corrected header files. They can be updated using the
mkheaders
script installed in
libexecdir/gcc/target/version/install-tools/.
double
in memory.
Compiled code moves values between memory and floating point registers
at its convenience, and moving them into memory truncates them.
You can partially avoid this problem by using the -ffloat-store option (see Optimize Options).
Next: C++ Misunderstandings, Previous: Standard Libraries, Up: Trouble [Contents][Index]