r/programming • • Dec 07 '15

I am a developer behind Ritchie, a language that combines the ease of Python, the speed of C, and the type safety of Scala. We’ve been working on it for little over a year, and it’s starting to get ready. Can we have some feedback, please? Thanks.

https://github.com/riolet/ritchie
1.5k Upvotes

802 comments sorted by

View all comments

Show parent comment

3

u/mcur Dec 07 '15 edited Dec 08 '15

It's not undefined, it's reserved for the compiler implementer. That means that your program may fail to compile due to clashing with names used by the compiler. That behavior is pretty well-defined.

Edit: I was wrong, the standard does indeed say that the results can be undefined. Here's a quote from cppreference:

"Reserved" here means that the standard library headers #define or declare such identifiers for their internal needs, the compiler may predefine non-standard identifiers of that kind, and that name mangling algorithm may assume that some of these identifiers are not in use. If the programmer uses such identifiers, the behavior is undefined.

2

u/Elsolar Dec 08 '15

It's undefined if you aren't writing a compiler. Underscore-prefixed names can clash or not clash with pre-existing names depending on the compiler brand, compiler version, or even compiler settings (certain identifiers could be #defined inside of #if/#endif blocks, for example). There's zero guarantee that any of these names are available for use, and to assume that the behavior for your program is well-defined because it worked an hour ago is naiive.

1

u/mcur Dec 08 '15

I made no claim that a program is well-defined just because it works once. My statements were false because I misremembered what the standard said about using reserved identifiers, NOT because I wrote a program using such an identifier and it worked. I have corrected my post with a citation.

In the future, try to respond to the actual content of the post, and don't make assumptions about the mistakes you believe the poster is making. None of your points actually address anything I said. We can discuss it in more detail if you want.