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
Printable View
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
> 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 :p
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.Quote:
Originally Posted by matsp
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
Yes, page fault or seg fault or something. I am not 100% on what those terms mean because I have never needed them.
I am not a Linux dev.
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
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.Quote:
Originally Posted by matsp
Use __errno instead of _errno since __errno is reserved for any use.Quote:
Originally Posted by matsp
In file scope only, so I would think that using it with a macro intended for use in any scope would be a bug.Quote:
Originally Posted by matsp
Of course, assuming that you are not implementing the implementation.Quote:
Originally Posted by matsp
What do you mean by "use of a reserved keyword"? The use of sizeof is correct in this case.Quote:
Originally Posted by itCbitC
Quote:
Originally Posted by itCbitC
Code:L
i
Windows
u
x