[vox-tech] cygwin - segfault on array allocation

Micah J. Cowan micah at cowan.name
Wed Feb 8 13:31:31 PST 2006


On Wed, Feb 08, 2006 at 12:13:08PM -0800, Daniel A. Lorca-Martinez wrote:
> >  > First: note that the above is not portable code. C++ does not support
> >>  variable-length arrays (that is, the bracketed expression must be a
> >>  constant). As long as you're constraining yourself to g++, though, or
> >>  other ones that support this extension, you're fine. (VLAs /are/
> >>  supported in the current version of the ISO C Standard, BTW).
> >
> >How does one gain this kind of knowledge at fingertips?
> >
> >(snip)
> 
> Well, one way is to occasionally work with less forgiving 
> compilers...then you find out that they're not actually wrong when 
> you bang your head against a wall for some really stupid bug :).

I've thought from time to time of building a virtual C implementation
that pushes the extremes (configurably) of what a conforming
implementation is allowed to have. For instance, 9-bit bytes (char type,
and that wouldn't apply to POSIX apps), non twos-complement
representation for signed integers... I'd still like to do this
sometime, but really I'm guessing a good lint catches a lot of the sorts
of things this might address. Still, it'd be fun, and I could have it do
crazy things when "undefined behavior" is invoked (still can't work out
how to make demons (daemons?) fly out the user's nose, though. I'd still
like to implement this idea sometime...

It's my understanding that certain forms of undefined behavior, in
ancient versions of gcc, would cause it to fire up nethack. :-)

-- 
Micah J. Cowan
micah at cowan.name


More information about the vox-tech mailing list