5 ms·
That's for local variables. Microsoft and Linus Torvalds didn't like it, because it's a way to suddenly cause unexpected stack growth of arbitrary size. That f
by Animats 9y ago
That's for local variables. Microsoft and Linus Torvalds didn't like it, because it's a way to suddenly cause unexpected stack growth of arbitrary size. That feature was made optional in C++11, and Microsoft never implemented it.
- Arnavion 9y agoFWIW Microsoft does have SAL annotations to do the same thing. For example fread's prototype is size_t fread( _Out_writes_bytes_(_ElementSize*_Count) void * _DstBuf, _In_ size_t _ElementSize, _In_ size_t _Count, _Inout_ FILE * _File ); https://docs.microsoft.com/en-us/visualstudio/code-quality/annotating-function-parameters-and-return-values https://docs.microsoft.com/en-us/visualstudio/code-quality/a...
- MaulingMonkey 9y agoC++ compilers also have references to arrays which can be abused in some cases: template < size_t len > int read(int fd, char (&buf)[len]); // array size will be infered int read(int fd, char (&buf)[1024]); // array size must be exactly 1024