www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/22/13:39:47

Xref: news2.mv.net comp.os.msdos.djgpp:5266
From: u951303 AT cedi DOT daimi DOT aau DOT dk (Kristian H|gsberg Kristensen)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Q: C src as comments in Assembly output?
Date: 22 Jun 1996 16:41:04 +0200
Organization: DAIMI, Computer Science Dept. of Aarhus Univ.
Lines: 22
Sender: u951303 AT cedi DOT daimi DOT aau DOT dk
Message-ID: <y6yenn79a0v.fsf@cedi.daimi.aau.dk>
References: <1996Jun20 DOT 190355 AT uctvms DOT uct DOT ac DOT za>
NNTP-Posting-Host: cedi.daimi.aau.dk
In-reply-to: stwand07@uctvms.uct.ac.za's message of 20 Jun 96 19:03:55 +0200
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Mark Wodrich writes:

>  As a self-tutoring method, I'd like to see what assembly code results from my C
>  program. So, is it possible to have the compiler produce assembly code _with_
>  the C code as comments, like :

If you write asm("foo") the string foo will be inserted in the 
assembly output produced by the c-compiler. However the
c-preprocessor is *not* run on the compiler output, so you 
cant use c-style comments; you'll have to use whatever 
commentchar as accepts (I belive this is ';' but I'm not sure..)
So if you write:

	asm("; put pixel\n")
	screen[x+y*WIDTH]=c;

you'll have the line "; put pixel" (note the \n) inserted just 
before the asm produced for the c-code.

regards,
Kristian Hogsberg
u951303 AT daimi DOT aau DOT dk

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019