←back to thread

The provenance memory model for C

(gustedt.wordpress.com)
224 points HexDecOctBin | 4 comments | | HN request time: 0.842s | source
Show context
zombot ◴[] No.44422335[source]
Does C allow Unicode identifiers now, or is that pseudo code? The code snippets also contain `&`, so something definitely went wrong with the transcoding to HTML.
replies(4): >>44422382 #>>44422416 #>>44422634 #>>44424896 #
qsort ◴[] No.44422382[source]
Quoting cppreference:

An identifier is an arbitrarily long sequence of digits, underscores, lowercase and uppercase Latin letters, and Unicode characters specified using \u and \U escape notation(since C99), of class XID_Continue(since C23). A valid identifier must begin with a non-digit character (Latin letter, underscore, or Unicode non-digit character(since C99)(until C23), or Unicode character of class XID_Start)(since C23)). Identifiers are case-sensitive (lowercase and uppercase letters are distinct). Every identifier must conform to Normalization Form C.(since C23)

In practice depends on the compiler.

replies(1): >>44422453 #
dgrunwald ◴[] No.44422453[source]
But the source character set remains implementation-defined, so compilers do not have to directly support unicode names, only the escape notation.

Definitely a questionable choice to throw off readers with unicode weirdness in the very first code example.

replies(1): >>44422534 #
qsort ◴[] No.44422534[source]
If it were up to me, anything outside the basic character set in a source file would be a syntax error, I'm simply reporting what the spec says.
replies(2): >>44422647 #>>44423260 #
1. ncruces ◴[] No.44422647[source]
I use unicode for math in comments, and think makes certain complicated formulas far more readable.
replies(1): >>44424358 #
2. kzrdude ◴[] No.44424358[source]
I've just been learning pinyin notation, so now i think the variable řₚ should have a value that first goes down a bit and then up.
replies(1): >>44424558 #
3. zelphirkalt ◴[] No.44424558[source]
I am not sure it is a good idea to mix such specific phonetic script ideas about diacritic marks with the behavior of the program over time. Even considering the shape, it does not align with the idea of first down a little, then up a lot.
replies(1): >>44432063 #
4. kzrdude ◴[] No.44432063{3}[source]
To be sure, it's a joke. Mostly trying to joke at the expense of these excessively complicated variable names (that are only there because it's pseudocode) :)

And yeah, the chinese tone in practice does not align with the idea of "down a little up a lot" either. It depends on context...