delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/04/20/18:18:26

From: "Alexei A. Frounze" <dummy_addressee AT hotmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Printing function pointers
Date: Fri, 20 Apr 2001 18:07:08 -0400
Organization: Global Crossing Telecommunications
Lines: 45
Sender: UNKNOWN AT 209-130-221-145 DOT nas1 DOT roc DOT gblx DOT net
Message-ID: <9bqbrl$5ru$1@node17.cwnet.frontiernet.net>
References: <3AE082F7 DOT B4E9C05 AT jps DOT net>
NNTP-Posting-Host: 209-130-221-145.nas1.roc.gblx.net
X-Trace: node17.cwnet.frontiernet.net 987804341 6014 209.130.221.145 (20 Apr 2001 22:05:41 GMT)
X-Complaints-To: abuse AT frontiernet DOT net
NNTP-Posting-Date: 20 Apr 2001 22:05:41 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Dennis Yelle" <dennis51 AT jps DOT net> wrote in message
news:3AE082F7 DOT B4E9C05 AT jps DOT net...
> I was surprised by the output from this program:
> ---------------------
> #include <iostream>
>
> 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?

Good Luck
--
Alexei A. Frounze
alexfru [AT] chat [DOT] ru
http://alexfru.chat.ru
http://members.xoom.com/alexfru/
http://welcome.to/pmode/



- Raw text -


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