Actually the Greek question mark (;) looks like the Latin semi-colon (;)!
Last time I looked it up I think I found they are the same characters, and I tried compiling C with a Greek question mark instead of a semi-colon and it compiled fine! But I'm curious if it was because of something else, like my computer's keyboard layout, or the compiler simply being able to handle them 🤔
Something somewhere was definitely doing the conversion for you, but it could have been your editor, the compiler or something in between like a C preprocessor directive getting loaded in by your configuration.
In C and C++, the source character set is implementation defined. This means that each compiler sets its own rules about what characters are accepted. For example compilers could choose to accept ASCII or EBCDIC or Unicode, or some combination, etc.
So the ISO standard will say that ; character is the end of statement punctuation. But it is up to the compiler to say which character(s) or code point(s) represent the ISO ;.
The ISO standards also require compilers to define a separate execution character set to specify values that can be stored in char and used with the string library functions. The execution character set doesn't have to be the same as the source character set.
Edit: I should also mention that the rules for this stuff are changing a lot in ISO C23 and C++23. (Which standards I haven't yet personally adopted.) Basically the ISO 23 standards mandate compilers to support UTF-8 source files, and they map every source character in the ISO standard to its corresponding Unicode character.
Mhh today I learned. That's wild. I would have thought that any sane person would allow only 7-bit ASCII for the source code, and forward-compatible character sets in strings (every standard iteration being allowed to add characters, but not remove them).
My old job legitimately did this in C++ with a Perl script because we had to be able to build on some weird, old systems and couldn't use C++ templates.
That's what I use to show people the exact message I sent before. It gets around any app that doesn't let you send blank messages. I have it saved on my clipboard for this
It has 128 languages, it starts with ruby which prints out its own source code in Scala, then the Scala program executes to generate the next source code, repeat for 128 languages and eventually returns to the original ruby code.
For extra fun, look at the source code on a large monitor.
I had to start reading that three times over, because I saw they mentioned "Canadian" and just assumed the angle brackets are a joke in reference to the Canadians in South Park:
Generics aren't really OOP, OOP tends to use run time dynamic dispatch through inheritance. Generics come from functional programming type constructors.
You're thinking of architecture astronauts when talking about generics. The biggest win of the object-oriented folks was to get a garbage collector included by default; compare and contrast with Rust, which ended up not having garbage collection.
46 Comments
apftwb@lemmy.world · 191 pts · 110d
These are angle brackets
These are Canadian Aboriginal Syntax Blocks
boonhet@sopuli.xyz · 79 pts · 110d
Most compilers tell you what's up these days, but
Greek question mark
Semicolon
kivihiili@lemmy.blahaj.zone · 29 pts · 110d
mm our font renders them basically the same hehe
screenshot:
Warehouse@piefed.ca · 24 pts · 110d
It looks like this for me. Granted I'm on Piefed so that's probably part of the reason.
Rekorse@sh.itjust.works · 3 pts · 109d
Mines like yours too.
Rubanski@discuss.tchncs.de · 7 pts · 108d
That's the classic Japanese font also used in many Nintendo games like Wii sports, right?
raspberriesareyummy@lemmy.world · 25 pts · 110d
Corporate needs you to find....
d_k_bo@feddit.org · 22 pts · 109d
Yes, upper case angle brackets.
ruuster13@lemmy.zip · 6 pts · 110d
There's room for my mom and your mom in programming.
slazer2au@lemmy.world · 156 pts · 110d
Unicode truly is amazing.
Like that fake apple site that uses the Cyrillic A instead of the Latin A.
Or the Greek question mark being a different code to Latin question marks.
gkaklas@lemmy.zip · 72 pts · 110d
Actually the Greek question mark (
;) looks like the Latin semi-colon (;)!Last time I looked it up I think I found they are the same characters, and I tried compiling C with a Greek question mark instead of a semi-colon and it compiled fine! But I'm curious if it was because of something else, like my computer's keyboard layout, or the compiler simply being able to handle them 🤔
palordrolap@fedia.io · 42 pts · 110d
Something somewhere was definitely doing the conversion for you, but it could have been your editor, the compiler or something in between like a C preprocessor directive getting loaded in by your configuration.
418_im_a_teapot@sh.itjust.works · 6 pts · 110d
I'd be pissed if it was my editor. A compiler used on a global scale would make sense.
raspberriesareyummy@lemmy.world · 22 pts · 110d
Nah, I would absolutely want my compiler to error out hard on characters that are not allowed per the standard.
mkwt@lemmy.world · 4 pts · 109d
In C and C++, the source character set is implementation defined. This means that each compiler sets its own rules about what characters are accepted. For example compilers could choose to accept ASCII or EBCDIC or Unicode, or some combination, etc.
So the ISO standard will say that ; character is the end of statement punctuation. But it is up to the compiler to say which character(s) or code point(s) represent the ISO ;.
The ISO standards also require compilers to define a separate execution character set to specify values that can be stored in char and used with the string library functions. The execution character set doesn't have to be the same as the source character set.
Edit: I should also mention that the rules for this stuff are changing a lot in ISO C23 and C++23. (Which standards I haven't yet personally adopted.) Basically the ISO 23 standards mandate compilers to support UTF-8 source files, and they map every source character in the ISO standard to its corresponding Unicode character.
raspberriesareyummy@lemmy.world · 2 pts · 109d
Mhh today I learned. That's wild. I would have thought that any sane person would allow only 7-bit ASCII for the source code, and forward-compatible character sets in strings (every standard iteration being allowed to add characters, but not remove them).
mkwt@lemmy.world · 3 pts · 109d
At the time that C was designed, ASCII was not a universal standard. It was one encoding competing with other encodings.
VindictiveJudge@lemmy.world · 34 pts · 110d
Wait, does C read like valley girl speech in Greek?
raspberriesareyummy@lemmy.world · 16 pts · 110d
Shit - the next five weeks I'll read C++ lines in upspeak in my head :(
Bazoogle@lemmy.world · 9 pts · 109d
That would be a homograph attack: https://en.wikipedia.org/wiki/IDN_homograph_attack
Australis13@fedia.io · 133 pts · 110d
I don't know whether to be impressed or horrified.
obelisk_complex@piefed.ca · 92 pts · 110d
"Both" is also acceptable.
bitjunkie@lemmy.world · 26 pts · 110d
Yes.
pooberbee@lemmy.ml · 67 pts · 110d
My old job legitimately did this in C++ with a Perl script because we had to be able to build on some weird, old systems and couldn't use C++ templates.
30p87@feddit.org · 53 pts · 110d
It's fucking genius
einkorn@feddit.org · 51 pts · 110d
They were too preoccupied with whether they could instead of asking whether they should.
Deebster@infosec.pub · 20 pts · 110d
I wonder if you could write a valid program in two different languages using this technique.
9point6@lemmy.world · 41 pts · 110d
You can do it with any language where whitespace doesn't matter and Whitespace
SmackemWittadic@lemmy.world · 8 pts · 110d
That's what I use to show people the exact message I sent before. It gets around any app that doesn't let you send blank messages. I have it saved on my clipboard for this
SmackemWittadic@lemmy.world · 5 pts · 110d
Natanael@slrpnk.net · 22 pts · 110d
Absolutely, that's a polyglot file
vrek@programming.dev · 33 pts · 110d
Not quite this exact case but I love showing people https://github.com/mame/quine-relay
It has 128 languages, it starts with ruby which prints out its own source code in Scala, then the Scala program executes to generate the next source code, repeat for 128 languages and eventually returns to the original ruby code.
For extra fun, look at the source code on a large monitor.
cypherpunks@lemmy.ml · 3 pts · 110d
amazing! it's great to see that is still being maintained after so many years.
trem@lemmy.blahaj.zone · 48 pts · 110d
I had to start reading that three times over, because I saw they mentioned "Canadian" and just assumed the angle brackets are a joke in reference to the Canadians in South Park:
yetAnotherUser@lemmy.ca · 37 pts · 110d
Uncaffeinated needs Lisp in their life. The programming language doesn't have a feature you need? Implement it yourself 👍
mercano@lemmy.world · 34 pts · 110d
Things to remember if you ever enter an obfuscated code competition.
poopsmith@lemmy.ml · 34 pts · 110d
The OOP goons eventually won and Go added generics a few years back.
gnutrino@programming.dev · 28 pts · 110d
Generics aren't really OOP, OOP tends to use run time dynamic dispatch through inheritance. Generics come from functional programming type constructors.
Corbin@programming.dev · 23 pts · 110d
You're thinking of architecture astronauts when talking about generics. The biggest win of the object-oriented folks was to get a garbage collector included by default; compare and contrast with Rust, which ended up not having garbage collection.
ripcord@lemmy.world · 10 pts · 110d
Huh.
https://go.dev/doc/tutorial/generics
firelizzard@programming.dev · 3 pts · 110d
You make that sound like a bad thing
LodeMike@lemmy.today · 12 pts · 110d
Doesn't go actually have generics?
dbx12@programming.dev · 22 pts · 110d
anon_8675309@lemmy.world · 7 pts · 110d
That’s the problem with the internet, it has no memory.
freeman@sh.itjust.works · 6 pts · 110d
;;;;;;;;
Solemarc@lemmy.world · 2 pts · 108d
Imagine reinventing preprocessor macros in go...