Spyke
lemmy.world

<>

These are angle brackets

ᐸᐳ

These are Canadian Aboriginal Syntax Blocks

189

Most compilers tell you what's up these days, but

;

Greek question mark

;

Semicolon

78
Warehousereply
piefed.ca

It looks like this for me. Granted I'm on Piefed so that's probably part of the reason.

24
lemmy.world

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.

155
gkak.laₛreply
lemmy.zip

Greek-Latin question marks

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 🤔

72
fedia.io

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.

42
lemmy.world

Nah, I would absolutely want my compiler to error out hard on characters that are not allowed per the standard.

22
mkwtreply
lemmy.world

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.

4
lemmy.world

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).

2

At the time that C was designed, ASCII was not a universal standard. It was one encoding competing with other encodings.

3

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.

67

They were too preoccupied with whether they could instead of asking whether they should.

51
Deebsterreply
infosec.pub

I wonder if you could write a valid program in two different languages using this technique.

20
vrekreply
programming.dev

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.

33

amazing! it's great to see that is still being maintained after so many years.

3

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:

48

Uncaffeinated needs Lisp in their life. The programming language doesn't have a feature you need? Implement it yourself 👍

37
lemmy.ml

The OOP goons eventually won and Go added generics a few years back.

35

Generics aren't really OOP, OOP tends to use run time dynamic dispatch through inheritance. Generics come from functional programming type constructors.

27

Things to remember if you ever enter an obfuscated code competition.

33

You reached the end