:: Re: [DNG] Dng Digest, Vol 13, Issue…
Top Page
Delete this message
Reply to this message
Author: KatolaZ
Date:  
To: aitor_czr
CC: dng
Subject: Re: [DNG] Dng Digest, Vol 13, Issue 53
On Mon, Oct 19, 2015 at 09:09:03PM +0200, aitor_czr wrote:
> I use the '==' operator. For example, in the case of a file:
>
> FILE *fp;
>
> if ( fp = fopen ( "file_name", "w") == NULL) { ... error message,
> and exit... }
>


That's surely legal, but I usually find

if ( !(fp = fopen(whatever, "r")){ error_message();}

a little more readable. Anyway, I always prefer to disentangle
assignments and conditional expressions, just and only for the sake of
improving readability:

fp = fopen(whatever, "r");
if (!fp){error_message();}

Debugging C code is already a pain in the ass, so there is no reason
to make it even more painful with syntax back somersaults....

My2Cents

KatolaZ

--
[ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ]
[ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ]
[ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ]
[ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ]