Newsgroups: comp.os.msdos.djgpp From: manfred DOT heumann AT uni-bielefeld DOT de (Manni Heumann) Subject: Re: Allegro,BITMAP *buffer; References: <37E1B735 DOT C564EEB AT gtcom DOT net> <05a4d7f6 DOT 74e084f3 AT usw-ex0102-016 DOT remarq DOT com> <37E294DB DOT 87A9535D AT gtcom DOT net> X-Newsreader: News Xpress 2.01 Date: Fri, 17 Sep 1999 20:32:50 GMT NNTP-Posting-Host: ppp36-386.hrz.uni-bielefeld.de Message-ID: <37e2a574.0@news.uni-bielefeld.de> X-Trace: 17 Sep 1999 22:32:52 +0200, ppp36-386.hrz.uni-bielefeld.de Lines: 53 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com In article <37E294DB DOT 87A9535D AT gtcom DOT net>, krogg DOT no DOT to DOT spam AT gtcom DOT net wrote: >Varence wrote: >> >> Also, try declaring BITMAP *buffer at the head of the >> function, and buffer = create_bitmap(1024,768) after. If >> you have other instructions prior to this, rather than just >> declarations, your compiler might be spewing. >> >If i understand you correctly >then you are saying do this: > >BITMAP *buffer; >int main(void) >{ > buffer=create_bitmap(1024,768); >} > >instead of doing this: > >int main(void) >{ >BITMAP *buffer=create_bitmap(1024,768); >} > >OK,I tried it and it worked great.I dont understand why >but I will think about it a while and see if i can.Thanks, >my program looks nice in double buffering. > > No, he meant: int main (void) { BITMAP *buffer; do_some_other_stuff(); } instead of: int main (void) { do_some_stuff(); BITMAP *buffer; } This is one of the differences between C and C++. In C you cannot create variables anywhere you want to, C++ has serious reasons to allow this. -- Manni