Re:Why 37signals Doesn't Hire Programmers Based on Brainteasers
by haberman on Thursday January 05, 2012 @08:37PM
(#3431520)
This inspired me to write one that is even shorter and doesn't heap-allocate any memory at all. What can I say, I'm a sucker for minimal C.
[ Parent
| on HN ]
Re:Why 37signals Doesn't Hire Programmers Based on Brainteasers
by demallien on Friday January 06, 2012 @01:21AM
(#3432255)
When did C start accepting non-constants for array size declarations?
Re:Why 37signals Doesn't Hire Programmers Based on Brainteasers
by hn_reader on Friday January 06, 2012 @01:52AM
(#3432330)
I was wondering the same thing. But I can confirm it compiles and runs, though I had to supply a -std=c99 flag to gcc.
Re:Why 37signals Doesn't Hire Programmers Based on Brainteasers
by demallien on Friday January 06, 2012 @06:02AM
(#3432841)
Ahhh, useful tip. I've just been using alloca instead...
Re:Why 37signals Doesn't Hire Programmers Based on Brainteasers
by haberman on Friday January 06, 2012 @04:06AM
(#3432604)
Variable-length arrays were added in C99.
Re:Why 37signals Doesn't Hire Programmers Based on Brainteasers
by hn_reader on Thursday January 05, 2012 @11:10PM
(#3431930)
Best solution I've seen here so far.
Re:Why 37signals Doesn't Hire Programmers Based on Brainteasers
by shaggyfrog on Friday January 06, 2012 @02:47AM
(#3432456)
If row is too big you can bust your stack frame when you define your data array.