www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/05/21:39:48

Xref: news2.mv.net comp.os.msdos.djgpp:2473
From: nicolas AT dsys DOT ceng DOT cea DOT fr (Eric NICOLAS)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: C Question
Date: 5 Apr 1996 12:45:27 GMT
Organization: Commissariat a l'energie atomique Grenoble (France)
Lines: 37
Message-ID: <4k34l7$b4k@news.cea.fr>
References: <9604051057 DOT AA52478 AT ibm1 DOT cicrp DOT jussieu DOT fr>
Reply-To: nicolas AT dsys DOT ceng DOT cea DOT fr
NNTP-Posting-Host: hudson.ceng.cea.fr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

>I simply have several question in mind about compilation of C.
>
>When I do:
>int i;
>
>i=3+4;
>
>Does GCC generate i=7 or i=3+4 ?
>
>I suppose the answer is the same for
>i=0x01 | 0x02 which is equal to i=0x03
>
>Again, in:
>#define FIVE 3+2
>
>is it the same, for the compiled program as #define FIVE 5 ?

Well, the best way to check that kind of thing is to

1. for #define : Just preprocess, and look in a place where the symbol
   has been replaced.
2. for other stuff : Compile to assembly language and check the
   generated code.

With those 2 tricks, you will be able to know everything about what
the compiler does with your code :-)

Hope it helps.

-- 
Eric Nicolas <nicolas AT dsys DOT ceng DOT cea DOT fr>

Take a look to the SWORD home page :
	http://mimine.iut.univ-metz.fr/~borysgr/sword.web/home.html


- Raw text -


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