Message-ID: <378ED3CB.92B0CF73@vetec.com> Date: Fri, 16 Jul 1999 01:40:11 -0500 From: Andy Goth X-Mailer: Mozilla 4.61 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: Marker References: <378E8DD5 DOT 68B571A AT vetec DOT com> <378EC477 DOT DA0C222D AT cartsys DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com > > 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. > > If you don't care exactly where in the binary it ends up, you could just > do > > static char my_comment[] = "Hello, world"; > > The compiler may warn you about an unused static variable, though. It would need to be found, so if I did this I would have to put some unique token at the beginning that coudl not turn up anywhere else. That's not the best idea... > > I imagine that maybe I could do it with inline assembly that jumps over > > a text string, but would the optimizer throw that out? > > If you want to have it in just the right place, then yes, you could do > that. Using `volatile' will prevent the optimizer from moving or > removing it (in fact I think it might not even be necessary for asms > with no output). I heard to use asm volatile from someone else, too. Does this work in C as well as in C++? I read that the "asm" keyword is new for C++. However, I see inline assembly in Allegro. Hmm. Is this a deviation from the standard? > asm volatile("jmp 0f; .string \"Hello, world\"; 0:"); Is that really jmp 0f? ^ ___ _ _ ____ _ _ / _ \| \ | | _ \\ \_/ / .--------[ ICQ#: 35256413 ]--------. | |_| | \| | | | |\ / | 01001000011001010110110001101100 | | _ | \ \ | | | | | | | 01101111001011000010000001110111 | | | | | |\ | |_| | | | | 01101111011100100110110001100100 | |_| |_|_| \_|____/ |_| `--[ mailto:andygoth AT vetec DOT com ]---'