X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: "Jacky Luk" Newsgroups: comp.os.msdos.djgpp Subject: Re: Declaring variables in GAS Date: Mon, 8 Apr 2002 21:00:17 +0800 Organization: IMS Netvigator Lines: 48 Message-ID: References: NNTP-Posting-Host: pcd653040.netvigator.com X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Hans-Bernhard Broeker" ¼¶¼g©ó¶l¥ó·s»D :a8rsi9$lt$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE... > Jacky Luk wrote: > > This is the first time I get it-> > > You got it wrong. You were asking about a *global* variable and how > to declare it in asm. But your C example only has a variable local to Could you show me also how to do it with a local var.? Thanks a lot > function main. > > Try this instead: > > #include > > int foo1 = 100; > > int main() > { > > printf ("%d\n", foo1); > return 0; > > > } > > And the important fragments of the assembly output you'll get are: > > .globl foo1 > .data > foo1: > .align 4 > .long 100 > > And to get it into a register: > > movl foo1,%eax > > > > -- > Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) > Even if all the snow were burnt, ashes would remain.