Re: Goto still considered ful
Keith Thompson <kst-u@mib.org> writes:
> Flash Gordon <spam@flash-gordon.me.uk> writes:
>> Keith Thompson wrote, On 19/10/07 07:29:
>>> Ben Pfaff <blp@cs.stanford.edu> writes:
>>>> CBFalconer <cbfalconer@yahoo.com> writes:
<snip>
>>>>> if (sf = fopen(src, "r") { /* text files */
<snip>
>>>> I think that this is a bad idea:
<snip>
>>>>> }
>>> If the first fopen() fails, no value is assigned to df, and accessing
>>> it invokes undefined behavior.
>>
>> If the first fopen fails sf will be a null pointer and short circuit
>> evaluation ensures that df is not accessed, so it is OK.
>
> You're right.
....but it is still a syntax error!
--
Ben.
|