Question about the code...
Robert Heller
heller at deepsoft.com
Fri Feb 6 21:01:34 UTC 2009
At Fri, 6 Feb 2009 20:00:37 +0000 (UTC) Users of ISC DHCP <dhcp-users at lists.isc.org> wrote:
>
> The C specification mandates that global variables that are not
> explicitly initialized are set to 0 at program startup (before main is
> called). This is safe and legal, although it may be a little
> off-putting to the uninitiated.
Hmm... I guess I come from a very 'old school' (way back when in the
days of FORTRAN, K&R C, etc.), where it was a no-no to not explicitly
initialize variables (generally random bad things would happen). I
guess it might be a bit 'anal' to always explicitly initialize global
variables, but if nothing else it at least documents their initial
values clearly. I suspect that I might have worked with early C
run-time environments that did not follow this spec (like the early
pre-ANSI C compilers available under CP/M-68K, OS9/68K, and SunOS 3.x),
so I learned NOT to trust that global variables would be implicitly
initialzed to anything in partitular.
>
> See http://c-faq.com/decl/initval.html
>
> paul
>
> > Date: Thu, 5 Feb 2009 14:47:02 -0500
> > From: Robert Heller <heller at deepsoft.com>
> >
> > I just did some poking around in the source code for dhcp 3.0.1 (trying
> > to trace where dhcpd is dropping the ball WRT root-path. The variable
> > 'universe_count' is never explicitly initialized. I *guess* it is
> > *impoliticly* initialized to 0, but isn't it a really, really, bad idea
> > to assume implicit initialization to 0?
> _______________________________________________
> dhcp-users mailing list
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users
>
>
--
Robert Heller -- 978-544-6933
Deepwoods Software -- Download the Model Railroad System
http://www.deepsoft.com/ -- Binaries for Linux and MS-Windows
heller at deepsoft.com -- http://www.deepsoft.com/ModelRailroadSystem/
More information about the dhcp-users
mailing list