[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Use true/false or TRUE/FALSE in KDE C++ programs?
From:       Kevin Krammer <kevin.krammer () gmx ! at>
Date:       2005-05-29 15:24:24
Message-ID: 200505291724.29843.kevin.krammer () gmx ! at
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Sunday 29 May 2005 16:02, Richard Dale wrote:
> On Sunday 29 May 2005 16:48, André Wöbbeking wrote:
> > On Sunday 29 May 2005 15:36, Richard Dale wrote:
> > > I hate code which type puns ints into booleans such as:
> > >
> > > if !strcmp("mything", "myotherthing') {
> > > 	..other difficult to read crap code
> > > }
> >
> > this is a bad example as strcmp() returns a tristate: less, equal or
> > greater but I know what you mean.
>
> Well, it's a good example because it's so bad.. :)

I think Andre meant that it is a bad example for a missing boolean type 
because the function isn't a boolean function.

I agree that it is a example of bad coding, i.e. treating a non boolean return 
value as if it were one.

Unfortuntaley I don't even know a compiler switch which would make it check 
for true booleans in such expressions, like the Java compilers usually do.

Cheers,
Kevin

-- 
Kevin Krammer <kevin.krammer@gmx.at>
Qt/KDE Developer, Debian User
Moderator: www.mrunix.de (German), www.qtforum.org

[Attachment #5 (application/pgp-signature)]

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic