Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Newsgroups | comp.lang.c |
|---|---|
| Date | 2016-07-21 11:39 -0700 |
| Message-ID | <58720375-dff5-4abf-9475-4080c0feb740@googlegroups.com> (permalink) |
| Subject | Detecting Incomplete Array Initialization at Compile Time? |
| From | "David T. Ashley" <dashley@gmail.com> |
Found a bug related to incomplete array initialization yesterday. The form of the bug was:
enum
{
Apples,
Oranges,
Grapefruits,
MaxElements
};
int myarray[MaxElements] =
{
429,
258
//Oops, missing initializer--not intended.
//C-language defaults to 0.
};
Question: Is there any way to detect incomplete initialization at compile-time? (Any obscure feature of the language I'm not aware of?)
Caveat: I've oversimplified the problem for the purposes of example. Also, this occurred in an embedded system, and doing anything at runtime is off the table.
Back to comp.lang.c | Previous | Next — Next in thread | Find similar | Unroll thread
Detecting Incomplete Array Initialization at Compile Time? "David T. Ashley" <dashley@gmail.com> - 2016-07-21 11:39 -0700
Re: Detecting Incomplete Array Initialization at Compile Time? Ken Brody <kenbrody@spamcop.net> - 2016-07-21 14:47 -0400
Re: Detecting Incomplete Array Initialization at Compile Time? Keith Thompson <kst-u@mib.org> - 2016-07-21 12:42 -0700
Re: Detecting Incomplete Array Initialization at Compile Time? Tim Rentsch <txr@alumni.caltech.edu> - 2016-07-21 20:07 -0700
csiph-web