delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/10/19/15:19:54

Sender: mcowan AT mcowan-linux DOT transmeta DOT com
Newsgroups: comp.lang.c++,comp.os.msdos.djgpp
Subject: Re: Making C++ little easier to beginners...
References: <9qmkrh$581$1 AT tron DOT sci DOT fi>
From: Micah Cowan <micah AT cowanbox DOT com>
Message-ID: <yu8ofn3wit3.fsf@mcowan-linux.transmeta.com>
Lines: 43
User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7
MIME-Version: 1.0
Organization: Transmeta Corporation
Cache-Post-Path: palladium.transmeta.com!unknown AT mcowan-linux DOT transmeta DOT com
X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/)
Date: 19 Oct 2001 12:06:48 -0700
NNTP-Posting-Host: 209.10.217.66
X-Complaints-To: news AT globix DOT net
X-Trace: news.sjc.globix.net 1003518410 209.10.217.66 (Fri, 19 Oct 2001 12:06:50 PDT)
NNTP-Posting-Date: Fri, 19 Oct 2001 12:06:50 PDT
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> writes:

> Little example...
> 
> int    x = 10,
>         y = 10;
> 
> if(x == 10 && x == 10)        // Does this look scary or weird to you ?
>     cout << "true\n";
> else
>     cout << "false\n";
> 
> 
> wouldnīt this be nicer ?
> 
> if(x EQUAL 10 AND y EQUAL 10)
>     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        ^
> 
> As you can see the things "AND" & "OR" defined here are "bit" operators not "logical" operators.
> However, there really is no difference becourse you can use these two just as easily in "if" statementīs as in bit manipulation.
> 
> All calculations done in computer, from the simplest addition to the most complex 3rd grade (or greater) root solving uses these operatorīs and their compinations inside the microprocessor.


Your recommendations are completely unhelpful, since C++ *ALREADY* has
similar (better, in fact) token alternatives.  Some people prefer
them; most don't.  Because someone who is familiar with the language
is equally capable of understanding either; and in fact, sometimes the
shorter versions are easier (quicker) to read.

Micah

- Raw text -


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