Not to mention of course that going over the edge of the allocation is by no means guaranteed to fail in any particular manner - it is simply undefined behaviour.
--
Mats
Not to mention of course that going over the edge of the allocation is by no means guaranteed to fail in any particular manner - it is simply undefined behaviour.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
> We hear crash. Perhaps page fault, at best. Not SIGSEGV. Linux talk.
It's programmer talk, you should know what a signal is. And you should know what a segfault is.
As far as it goes, if it's in MSDN I'd expect a Windows programmer to acknowledge it. But MSDN is huge, and too I do see your point... so whatever
![]()
I suspect that we could classify that as a compiler bug rather than a user mistake. I would rather say that it is better to avoid such names entirely to avoid actually using a reserved name when a mistake places it in a context where it is reserved.Originally Posted by matsp
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
However, it may not be that - it may actually be a "segment fault" (general protection error) if the system is running in x86 protected mode using segments.
If we are not to assume that it is running any particular OS, then don't use terms that are specific to how the OS happens to implement its memory protection.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Really? How would you make the internal implementation of the errno expansion work, then? Most C libraries provide errno as a implementation specific macro that takes into account the current thread so that errno's are thread-safe. Unless we are using C++ where we could use namespaces, the only thing that would make errno expand in a way that is unlikely to collide with user-defined names is to use a name that is reserved for the compiler/library implementation - it may not be the names I've suggested, but it should be a name that is specific to the C-runtime.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Speaking of that, I was trying to make sense of the syntax, and apparently int[nnode+1] is a temporary variable length array. This would mean that sizeof(int[nnode+1]) == sizeof(int)*(nnode+1), if I understand variable length arrays correctly. Consequently, the whole point about segfault/page fault would be irrelevant.Originally Posted by matsp
Use __errno instead of _errno since __errno is reserved for any use.Originally Posted by matsp
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
In file scope only, so I would think that using it with a macro intended for use in any scope would be a bug.Originally Posted by matsp
Of course, assuming that you are not implementing the implementation.Originally Posted by matsp
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
What do you mean by "use of a reserved keyword"? The use of sizeof is correct in this case.Originally Posted by itCbitC
Originally Posted by itCbitC
Code:L i Windows u x
Last edited by laserlight; 01-05-2009 at 09:44 AM.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)