On Monday 19 February 2007 06:36, Evan Lavelle wrote:
> > SPICEdev CCCSinfo = {
> > DEVparam : CCCSparam,
> > DEVmodParam : NULL,
> > DEVload : CCCSload,
> > DEVsetup : CCCSsetup
> > };
>
> gcc extension, obsolete since gcc 2.5. The corect C99 form is
>
> > SPICEdev CCCSinfo = {
> > .DEVparam = CCCSparam,
> > .DEVmodParam = NULL,
> > .DEVload = CCCSload,
> > .DEVsetup = CCCSsetup
> > };
>
> This is only useful for out-of-order intialisation, so it's
> not relevant here anyway.
Actually, for large projects it helps a lot. The real structure
in Spice is much bigger than this. I cut it down to just
enough to ask the question. Spice-3 is now about 15 years old,
if you consider when people actually started using it, about 20
years old if you consider development and less used versions.
It has had some changes since then, some of which impact these
structures. This one is in every model, about 20 of them,
maybe 30 with extensions. If a revision adds one member, all
of them must change. Since they are all of the same type, the
compiler will not find the error if you miss one. You find out
later when the program doesn't work. If the test suite is not
complete, you may not find it even then, until a user who
doesn't know the code gets "segmentation fault", with no other
info.
I think named initialization like this should be required. A
little extra typing, which would usually be a copy-paste, goes
a long way in cutting debug time. It also helps readability a
lot.
Still ... if it is not standard, using it means someone can't
compile it. I use standard languages.
NGspice also uses // comments, which are not in standard C. I
would not be surprised if it requires gcc to compile.
I guess this means the gnucap-ngspice-models library also
requires gcc to compile. There is not much I can do about
this, because those model libraries use the Spice C code
without any modifications. I consider that to be a
requirement higher than portability.
_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev