|
From: <HBB...@t-...> - 2007-11-27 19:13:22
|
Allin Cottrell wrote: > On Tue, 27 Nov 2007, Hans-Bernhard Bröker wrote: >> Same difference. Adding a variable at the end of the struct has >> the same net effect, and the benefit of being less risky. An >> unsupported variable automatically defaults to zero, but an >> unsupported function defaults to an invalid function pointer, >> which is generally unsafe to use. > I thought things were set up so that an unsupported function > defaults to a null pointer (and my proposed code tests for that). Correct. More to the point, as long as new elements only get added at the end of the struct, every unsupported member defaults to a zero of the approriate type. Numeric variables end up as zero, pointers as null pointers. > On the other hand, having the scale variable > default to zero would not be good at all -- it should really > default to 1, though I suppose one could work around a broken > default of 0. Testing for variable == 0 is no harder than testing for function pointer == 0. |