Re: low-level question
- From: Johan Borkhuis <johan@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 31 Aug 2005 09:44:07 +0200
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 ==
.- References:
- low-level question
- From: jesso
- Re: low-level question
- From: tedu
- Re: low-level question
- From: Bryan Donlan
- low-level question
- Prev by Date: Re: How to free dynamically allocated array?
- Next by Date: Re: while (1) vs. for ( ;; )
- Previous by thread: Re: low-level question
- Next by thread: Re: low-level question
- Index(es):