this post was submitted on 12 May 2024
596 points (94.1% liked)

Memes

45535 readers
1273 users here now

Rules:

  1. Be civil and nice.
  2. Try not to excessively repost, as a rule of thumb, wait at least 2 months to do it if you have to.

founded 5 years ago
MODERATORS
 
all 50 comments
sorted by: hot top controversial new old
[–] x4740N 95 points 5 months ago (5 children)

Wouldn't most development programs tell them the syntax error on the line and column where you replaced the semicolon

This wouldn't work

[–] ShortFuse 75 points 5 months ago* (last edited 5 months ago)

VSCode will add a yellow box around the character and tell you it's an uncommon glyph.

https://code.visualstudio.com/updates/v1_63#_unicode-highlighting

To note, this came about because it could be valid code and it's a security risk from copy/pasting malicious code. See:

https://certitude.consulting/blog/en/invisible-backdoor/

[–] [email protected] 39 points 5 months ago

Just tested in the console, it gives an illegal character error and gives you the line number.

[–] Cipher22 16 points 5 months ago

It would work for someone just starting and not knowing good tooling yet. However, the compiler should also tell you where to look and give you the area to look at as well. It'll be less clear than an IDE, though.

[–] [email protected] 3 points 5 months ago* (last edited 5 months ago)

Yeah, doing something similar with brackets would be much more effective since that usually doesn't give a line number. Is there a unicode clone of )?

[–] kamen 2 points 5 months ago

Yup. It's as if we're assuming this friend is coding inside Notepad.

[–] [email protected] 64 points 5 months ago (2 children)

Why, of all possible languages, would you suggest this for Javascript where semicolons are not mandatory

[–] [email protected] 7 points 5 months ago
[–] [email protected] 51 points 5 months ago (2 children)

Even better would be to remap their keyboard's semicolon key to that symbol

[–] [email protected] 29 points 5 months ago (1 children)

Before I read this comment I believed the concept of hell was immoral.

[–] [email protected] 5 points 5 months ago

We all have the one friend or coworker..

[–] [email protected] 9 points 5 months ago

you are a criminal.

[–] Passerby6497 29 points 5 months ago

Meanwhile in VS Code: hey, I see this Unicode symbol that's confused for this expected symbol, would you like to replace it?

[–] tfw_no_toiletpaper 23 points 5 months ago (2 children)

Maybe if you're "coding" in notepad

[–] [email protected] 5 points 5 months ago

I had a friend who was a compsci minor who did almost the entirety of said minor on a really old chromebook. They did everything on a basic text editor. You would be surprised

[–] NegativeLookBehind 22 points 5 months ago (1 children)
[–] whotookkarl 2 points 5 months ago

BOM U+FEFF is another fun one, most editors won't show it but it can cause errors like when I found one in a SQL script that was combined from existing utf-8 files together with cat. You'll see it in a hex editor or in notepad I think it just made the rest of the line italic.

[–] moshtradamus666 20 points 5 months ago (2 children)

That's too evil. At my work people like to put a tape under someone's mouse and it can be pretty funny.

[–] [email protected] 6 points 5 months ago* (last edited 5 months ago) (3 children)

Some hairs under the lens, it gives some funny erratic moves of the pointer.

[–] TrickDacy 10 points 5 months ago (1 children)
[–] [email protected] 5 points 5 months ago

It's ok, someone either put a hair under his 'e' key, or remapped it so that it randomly spits out ' instead.

[–] [email protected] 7 points 5 months ago

The funny erratic movement can keep your work pc from locking up while you do nothing. It's win win.

[–] [email protected] 2 points 5 months ago

I just had this happen to me

I pulled a literal ball of pet fur out of the optical sensor

[–] Feyr 1 points 5 months ago

If you get a post-it just right halfway over the lens, the mouse will only move in one direction!

[–] [email protected] 15 points 5 months ago (2 children)

MSVC supports unicode. In C or C++, you could try:

#define ; ;

Second one is the greek semicolon but the client I'm using may strip it out. I'm too lazy to try.

[–] [email protected] 3 points 5 months ago (1 children)

Running #define ; anything yields error: macro names must be identifiers for both C and C++ in an online compiler. So I don't think the compiler will let you redefine the semicolon.

[–] [email protected] 3 points 5 months ago (1 children)

Haha. Thanks for checking. Given the C pre-processor, I'm sure there's a way to maliciously bork it if someone sets their mind to it.

[–] [email protected] 2 points 5 months ago* (last edited 5 months ago)

Well I just tried #define int void in C and C++ before a "hello world" program. C++ catches it because main() has to be an int, but C doesn't care. I think it is because C just treats main() as an int by default; older books on C don't even include the "int" part of "int main()" because it's not strictly necessary.

#define int void replaces all ints with type void, which is typically used to write functions with no return value.

[–] [email protected] 1 points 5 months ago

I'm not sure but I think the second one looks just a tiny bit different, so it should have worked.

[–] dlok 11 points 5 months ago

Wanted to use this to prank a colleague but SQL server accepts that as well lol

[–] Frozzie 9 points 5 months ago (1 children)

Hah. Try it on my version controlled project!

[–] [email protected] 5 points 5 months ago* (last edited 5 months ago) (1 children)

What? Remapping your keyboard? Well, there are worst jokes, I still remember that time when the first PCs appeared and you could try them in shopping centers. They quickly stopped doing this, because some went into the BIOS and disabled the keyboard or worse, the screen, Hail Satan. Good ol' times 😏

[–] Frozzie 2 points 5 months ago (1 children)

No I mean the code is on a git repository so you see unsaved changes

[–] [email protected] 4 points 5 months ago

When your keyboard is remapped, you commit those changes yourself.

[–] AwkwardTurtle 4 points 5 months ago
[–] TheHottub 3 points 5 months ago

Replace all

[–] idunnololz 1 points 5 months ago
[–] [email protected] 1 points 5 months ago

u/foundsatan

[–] reddit_sux 1 points 5 months ago

Would be cooler if u do it in C

[–] devfuuu -5 points 5 months ago* (last edited 5 months ago) (4 children)

Imagine using a language that still uses semicolons.

[–] [email protected] 12 points 5 months ago (1 children)

I still use it in Spanish, English and also in German, but certainly not very often.

https://www.merriam-webster.com/grammar/a-guide-to-using-semicolons

[–] [email protected] 3 points 5 months ago (1 children)

Klingon doesn't have a semicolon, switch to that.

[–] [email protected] 3 points 5 months ago

But they programm in Malbolge

[–] Hobbes_Dent 3 points 5 months ago

What about the Oxford semicolon in formal languages?

[–] Asudox 2 points 5 months ago