Mail Archives: djgpp/1999/07/17/23:16:33
> : Is there any way of inserting a marker into C code that is compiled but
> : not run? It would be really helpful if I could put comments (of a sort)
> : right into the binary.
> :
> : I imagine that maybe I could do it with inline assembly that jumps over
> : a text string, but would the optimizer throw that out?
>
> Hmm. Will the compiler remove 'const char s[] = "My string\n";'?
>
> If it does try 'struct { char s[], void *p } my_var = { "My string\n",
> &my_var };' wihch I haven't tested but should work. The trick is to
> make sure you reference the string somewhere in the code.
What does the void* p part do (besides add four extra unused bytes)?
___ _ _ ____ _ _
/ _ \| \ | | _ \\ \_/ / .--------[ ICQ#: 35256413 ]--------.
| |_| | \| | | | |\ / | 01001000011001010110110001101100 |
| _ | \ \ | | | | | | | 01101111001011000010000001110111 |
| | | | |\ | |_| | | | | 01101111011100100110110001100100 |
|_| |_|_| \_|____/ |_| `--[ mailto:andygoth AT vetec DOT com ]---'
<http://zap.to/andygoth/> <http://andygoth.cjb.net/>
- Raw text -