Re: low-level question



Bryan Donlan wrote:
tedu wrote:


jesso wrote:


3. How could you prevent this outcome without changing the code?

compile with -Dii="a = 1, b"


It's still undefined behavior, and can do whatever it wants.

Then how about this: compile with -D"strcpy(a,b)"="ii"

PS
I would have suggested this: -D"strcpy(a,b)"="strncpy((a),(b),sizeof(b))"
but that give problems with string.h, which can be avoided by doing the following:
touch string.h
touch stdio.h
gcc -nostdinc -isystem . -D"strcpy(a,b)"="strncpy((a),(b),sizeof(a))" \
-save-temps -o test test.c
but this is way to compiler and OS specific for the clc newsgroup :-)


Kind regards,
        Johan

--
       o o o o o o o . . .   _____J_o_h_a_n___B_o_r_k_h_u_i_s___
      o      _____           ||    http://www.borkhuis.com     |
    .][__n_n_|DD[  ====_____  |       johan@xxxxxxxxxxxx       |
   >(________|__|_[_________]_|________________________________|
   _/oo OOOOO oo`  ooo   ooo  'o!o!o                      o!o!o`
== VxWorks FAQ: http://www.xs4all.nl/~borkhuis/vxworks/vxworks.html ==
.