www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/10/18/14:49:12

From: jon_bills AT hotmail DOT com (Jon Bills)
Newsgroups: comp.lang.c++,comp.os.msdos.djgpp
Subject: Re: Making C++ little easier to beginners...
Date: 18 Oct 2001 11:39:56 -0700
Organization: http://groups.google.com/
Lines: 45
Message-ID: <38315c2d.0110181039.29608661@posting.google.com>
References: <9qmkrh$581$1 AT tron DOT sci DOT fi>
NNTP-Posting-Host: 62.7.71.123
X-Trace: posting.google.com 1003430396 28352 127.0.0.1 (18 Oct 2001 18:39:56 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: 18 Oct 2001 18:39:56 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Traveler" <traveler AT netti DOT fi> wrote in message news:<9qmkrh$581$1 AT tron DOT sci DOT fi>...
> Little example...
> 
> int    x = 10,
>         y = 10;
> 
> if(x == 10 && x == 10)        // Does this look scary or weird 
> to you ?

No. It looks like exactly you are ANDing the result of x == 10 with
the result of x == 10. I suppose that's a bit weird, but certainly not
scary.

>     cout << "true\n";
> else
>     cout << "false\n";
> 
> 
> wouldn?t this be nicer ?
> 
> if(x EQUAL 10 AND y EQUAL 10)

No. Why would you want to turn C++ into COBOL? Now, that is a bit
scary.

>     cout << "true\n";
> else
>     cout << "false\n";
> 
> Here?s little helper...
> 
> #define    AND        &
> #define    COMPLEMENT    ~
> #define    EQUAL    ==
> #define    EQU        EQUAL
> #define    NOT        !
> #define    OR            |
> #define    XOR        ^
> 

That's enough! How do you suppose obfuscating the C++ language behind
a set of dodgy preprocessor macros makes things easier for anybody,
particularly beginners? In fact, don't answer that.

Jon.

- Raw text -


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