Hacker News new | past | comments | ask | show | jobs | submit login

The point is that you sometimes want them on the stack and malloc won't do it for you. MSVC has this already though: https://msdn.microsoft.com/en-us/library/wb1s57t5.aspx

so I really don't think there is any good will there. It seems someone in the management is set on "C++ is the future, C is obsolete" view, at least that's the impression I've got from the press releases about it.




If you want them on the stack, it's safer to use MAX_SIZE so that you don't blow the stack when some arbitrary input arrives in the future.


1)There is sometimes a very slight performance hit as there is more space between arrays and you miss on cache

2)using something which is smaller than MAX_SIZE is never worse unless you write some safety critical software where a bug when you write to unintended but empty location is better than writing randomly somewhere and/or crashing. I prefer the latter in what I am doing (as it's easier to find something is very wrong)


The memory hit is an interesting point, could be useful if there's a static validation on worst case stack size.

The smaller allocation is worse as it hides potential bugs.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: