C, standards, and depending on them (was: New draft version of o65 file format)

From: Spiro Trikaliotis (ml-cbmhackers_at_trikaliotis.net)
Date: 2005-04-01 15:00:39

Hello Uz,

* On Fri, Apr 01, 2005 at 02:00:16PM +0200 Ullrich von Bassewitz wrote:
 
> And your advice is NOT good. Portable programs are programs that don't
> make assumptions about anything not defined in the standard. But they
> MUST trust the standard, because if they don't, all bets are off. If
> you write your code according to the standard, and it fails, it is
> because the compiler is broken.

In principle you are right. Anyway, there are many compilers, especially
for uC, which are not very compatible. Thus, if there is an easy
solution by initializing the variable, this is no problem to me, either.
I would call this defensive programming.

In fact, if I really rely on this behaviour (variables being
initialized), I find it much better if I make this assumption explicit
by writing the "= 0" after the definition of the variable. It does not
harm and (hopefully) tells the programmer after me that this was done
deliberately.

Regards,
   Spiro.

-- 
Spiro R. Trikaliotis
http://www.trikaliotis.net/

       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail pre-2.1.8.