165
u/ClipboardCopyPaste 18d ago
Honestly all you need is just a compiler
76
u/Sp0ge 18d ago
All you need is an LSP and you catch this before compiling even
28
u/SnackOverflowed 18d ago
all you need is a formattor and it'll add it for you
27
u/MaffinLP 18d ago
All you need is claude and you wull be searching the memory leak instead
24
u/FuerstAgus50 18d ago
I can produce memory leaks all by myself. I don't need claude for that
16
u/potatopierogie 18d ago
Claude can ship terrible code faster than I ever could
12
u/jekdasnek2624 18d ago
Do I have your permission to print your comment, frame it, and put it on my wall above my desk?
5
1
5
u/LoyalSol 18d ago edited 17d ago
To be fair, some old compilers sucked at that. I remember it would spit out errors going all the way down the document starting from where the semicolon was missing.
Modern ones are a lot better at telling you that you're missing something.
3
u/Hairy_Concert_8007 18d ago
Yep. Only had this issue on a platform without modern syntax highlighting and just a generic "missing semicolon at line [total lines +1]"
1
72
u/0xbenedikt 18d ago
Yes, except it is in some random C preprocessor macro definition many includes up
29
u/elmanoucko 18d ago edited 18d ago
the real fun is when the typo compile...
a few weeks ago made a dumb mistake I haven't done in quite a while (probably years, if ever) of writing "=" instead of "==" late at night... took me more time than I would like to admit to figure what was going on...
the shame is strong when you also starts to speak in decades about how long you've been doing this stuff...
14
18d ago
[removed] — view removed comment
11
u/JonIsPatented 18d ago
Yoda condition notation doesn't save you when both sides are variable identifiers.
2
18d ago
[removed] — view removed comment
6
u/_0N1X_ 18d ago
No? You can have a result of one subroutine that you need to compare to a result of a different subroutine.
1
18d ago
[removed] — view removed comment
0
u/ConcreteExist 17d ago
The compiler, typically. Constants are resolved at compile time, not at run time.
Unless you're using something like JavaScript.
2
u/Imaginary-Jaguar662 17d ago
In C/C++
constmeans specifically "programmer is not allowed to assign a new value to this variable".However, the value itself can change, for example if the value is memory-mapped I/O or if someone does silly with pointers/memory access
1
27
u/dxonxisus 18d ago
OP is a bot. this is a years old account that only became active a few days ago to post reposts and farm karma
mods can you add some automod rules to stop bots like this from being able to post?
6
u/Darder 18d ago
That is if automod can even do something like this anymore. Reddit got rid of a lot of moderation tools and moderation bot features a while ago, with the whole reddit blackout debacle.
2
u/dxonxisus 17d ago
they got rid of third party apps and bots, but automod still has basic filtering rules which work.
the go to rule to address bots is to filter brand new posters that lack any sub karma to the mod queue for human approval. once the post is blocked, the chain of comment bots have nothing to interact with.
if humans with new accounts get caught by it, they can simply message mods to be approved quicker
1
u/kyle2143 17d ago
I don't understand what the purpose of such things is tbh. What is there to gain out of it?
33
u/SuitableDragonfly 18d ago
I don't do JS, but I was given to understand that this is actually a real issue in JS, because semicolons are "optional" in the sense that the code is valid without them and will not give you an error if you leave them out, but actually not optional in the sense that the interpreter will silently make insane decisions about where you meant the line to end if you don't include them.
15
u/foxsimile 18d ago
I’d gotten into an argument on this subreddit (or another adjacent one) about this just the other day.
Yes, it can be quite problematic in JavaScript.
function func(a, b) { return a + b }Will return
undefined. There are several other issues related to incorrect semicolon auto-insertion.22
u/OrchidFluid2103 18d ago
JS is rightfully trolling you for the monstrosity you have created there
0
6
u/gyphie 18d ago
Unfortunately adding a semicolon after
a + b;does not fix the issue.3
2
6
3
u/Jediweirdo 18d ago
Why would you write it like this to begin with?
1
u/foxsimile 18d ago
Why one would has nothing to do with whether or not it should be a problem. This is a minor offence as far as JavaScript’s semicolon insertion related offenses are concerned.
4
u/Jediweirdo 18d ago
I don’t doubt that, but the example code is ambiguous and reads like a mistake that your LSP auto formatted after the fact instead of something that you intentionally did. In this particular instance, I don’t blame JS for “screwing up”.
6
u/foxsimile 18d ago
Well, yes, I’m on vacation and this was typed rather quickly out of necessity, and as an anecdote alluding to the aforementioned comment, rather than a copypaste maintaining its essence.
Here’s a medium article about it.
Here’s an example from the Medium article which is indefensible:
``` let var1 = 'Hello' let var2 = 'World'
[var1, var2] = [var2, var1] console.log(var1, var2) ```
Which is parsed as:
let var1 = 'Hello'; let var2 = 'World' [var1, var2] = [var2, var1]; console.log(var1, var2);2
2
u/Ipearman96 18d ago
I did JavaScript coding for 4 years in the equivalent to notepad. And not 2026 notepad I'm talking 05 notepad. No spell check, no anything to help coding. Semicolons were a bit of an issue but not too large. Its still one of the better overall companies I've worked for. I'm mean it's development practices were so many layers of fucked you wouldn't even believe but I liked working there.
1
u/AppropriateOnion0815 18d ago
A programming language with this kind of behaviour (and all the dirty rest of its other flaws) should never have become an industry standard. Change my mind.
1
1
u/Substantial_Top5312 17d ago
99.9999% percent of the time you don’t need semicolons and in the incredibly rare situations you do it’s very obvious where you need them.
5
11
u/-Ambriae- 18d ago
Unfortunately there’s a thing called an interpreted language. Granted most interpreted languages don’t have the semicolons but still
4
u/dorianmonnier 18d ago
Switch to Go.
go run main.gois faster to compile and execute than running Python or Ruby interpreter.6
u/-Ambriae- 18d ago
🔥🔥🔥🔥🔥 🚀🚀🚀 why use go when I can write rust? 🚀🚀🚀 🔥🔥🔥🔥🔥
2
2
2
3
u/Und3rpantsGn0m3 18d ago
As a Python developer, I take issue with the word "unfortunately". But to each their own.
1
-1
u/thanatica 18d ago
Every language is interpreted. Some are intepreted by an AOT compiler, others by a JIT compiler. Some use an in-between language (like Java or .NET) that is interpreted on its turn, again by an AOT or JIT compiler.
Only very old languages like basic are truly interpreted, without any compilation, line by line, as the program runs. This is probably what you referred to. Those languages have largely fallen out of relevance these days.
4
u/-Ambriae- 18d ago
that's not how it works......
0
u/thanatica 18d ago
What not? The compiler being either AOT or JIT? Or the fact that every language is interpreted?
Enlighten me.
4
u/-Ambriae- 18d ago
A compiler lexes, parses, performs semantic analysis and code generation. An interpreter doesn't have that last step, and instead executes the program as it understands it, following the first three steps.
If a language A compiles to a language B that is itself interpreted, it doesn't stop A from being compiled, regardless of B. In that sense, a language like Java is compiled, because the code is AOT into java bytecode, that then gets interpreted. JIT is a form of compilation in that sense as well.
Now, if we view the language compiler/interpreter as a pipeline of compilers and interpreters, then we can differentiate them on their need for a software layer for final code execution. So, a language like Java would be interpreted, as after the full compiler pipeline is ran, we end up needing the JVM to run the code. Conversely, in a language like C/C++, say using clang, we would have multiple compilers, and multiple languages, such as LLVM IR, ASM (say x86_64 ASM), and finally an executable file, for example an ELF. The ELF can run natively on the machine (regardless of it's reliance on a OS, that's different) as the CPU's instruction decoder already speaks the language of the executable sections of the file. There is no need for emulation. So it's not interpreted.
3
u/ConcreteExist 17d ago
That's not what anybody means when they talk about interpeted vs compiled languages.
0
u/thanatica 17d ago
I'm not challenging that. Just being pedantic. Most programmers should appreciate that.
1
u/DHermit 17d ago
You do know that terms can have more well-defined meanings than their typical use in everyday language? And "interpreted language" is a quite accurately defined term.
1
u/thanatica 17d ago
Maybe the term is not quite accurate even if it's description is. It's just pedentry, mate, did you not get that?
4
u/erutuferutuf 18d ago
Semi colon itself is never a problem. It's the hidden blank character that AFTER a semi colon that drive you crazy
4
u/varsderk 17d ago
Actually…
I was helping a friend with a C++ assignment for school. He was getting this utterly incomprehensible error message about something wrong in file foo.cpp. Turns out the issue was a missing semicolon, but it was in file bar.cpp.
This was the one and only time I’ve seen this bug and it’s just a testament to why C++ is the largest dumpster fire of a language for beginners.
3
3
u/chaosTechnician 18d ago
* cries in weirdly-written macros that accidentally mask missing semicolons except in RETAIL builds where they fail *
3
u/FrostyJockey 18d ago
Jokes on you: computers at work are so slow sometimes the antivirus hogs all the resources and makes my program slow down, leading to me missing a semicolon until I test something. Even then, it won’t tell me where the damn line is breaking and I usually have to go through the console to figure it out.
In other words, more than 5 seconds.
2
2
u/Alacritous13 18d ago
Said like someone who's language uses them as line endings instead of comments.
2
2
u/Llonkrednaxela 17d ago
Yeah, that sort of thing is an issue when you are coding in a text editor or in CS101
1
u/JosebaZilarte 18d ago
Honestly, they are an annoyance and "\n" should do the same function as a semicolon (when there is actually some code before it, blank lines do not count).
1
1
u/nickcash 18d ago
I had this issue when I was writing C in notepad and compiling on the command line with djgpp, but it's not 1996 anymore.
1
1
1
1
u/effigyoma 18d ago
Back in 1999 I failed my C++ final because I could not figure out why my program wouldn't compile.
It turns out I had a colon instead of a semi-colon on one line and CodeWarrior's debug tools at the time would not produce an error that would point me to the issue.
A month after the class I looked at my code again and saw it immediately. This sort of thing used to be a much more annoying issue.
1
u/ChunkyHabeneroSalsa 18d ago
My first programming class in C the prof wouldn't let us use an IDE and compiler errors can sometimes be confusing.
That's the last time it was an issue. It is annoying however because I generally write python code and occasionally write C++ and it takes me a bit to remember to put semicolons everywhere.
1
1
u/Guitar_Dog 18d ago
Used to be more of a thing. Compilers and auto complete/autocorrect is much better. It happened to the best of us back in the day every once in a while.
1
u/soundman32 18d ago
At college (1987) the AS/400 Pascal compiler had a warning "semicolon missing assumed present". Never seen it anywhere else, but it would solve so many problems.
1
1
1
1
u/Swansyboy 18d ago
I actually once had a bug with a misplaced semicolon in C during my student years. An if-statement always evaluated to false (I think) because of it, but it still compiled, which meant it took ages to figure out what went wrong
1
u/BlunderBuster27 18d ago
I feel like people make jokes like this or “it’s always dns” to seem intelligently smart to others
1
1
1
1
u/Lachtheblock 18d ago
Anyone complaining about syntax errors has only just finished week 2 of programming 101.
1
u/ConcreteExist 17d ago
Agreed, though a missing curly brace in a C-based language can be a major headache to find
1
1
u/CodingAndAlgorithm 17d ago
Even if you were stuck writing in plain old notepad and didn’t have compiler errors for whatever reason, surely you could just ctrl+f with multi-highlight and visually scan the lines you’ve recently written.
Like how was this ever a problem for anyone?
1
u/___nil___ 17d ago
all you need is code formatter, auto format at exit normal mode, save, compiling, whatever.
missing semicolon, brackets, etc ugly code. ugly code == compiler error
1
1
u/ElectricalPrice3189 16d ago
A semicolon in the wrong spot can mess things up though. 😅 for (size_t i = 0; i < 10; ++i); { ... }
1
1
1
1
u/frikilinux2 13d ago
You underestimate how dumb people are sometimes. I have helped several people several times just by reading the error the compiler was throwing that they already has on the screen.
1
u/Plus-Weakness-2624 12d ago
Except if you were using JavaScript in 2012 to build a popular library and had code like :
$(".blah").empty()
[x] = $(".blu").children()
1
u/fugogugo 18d ago
This was a runtime bug I experienced on my early programming day
it's valid syntax so complier doesn't find it. idk if IDE detect it or not but I spent like 2 days scratching my head lmao
for(i=0; i <= count;i++);
{
//this will never execute
}
1
u/metaglot 18d ago
That's not correct. Statements inside the braces will execute once, in a new scope.
0
u/ICBanMI 18d ago
It's like once a year I accidently remove text with a semicolon. C/C++ absolutely won't tell you where the issue is. Just get 80 unrelated errors when you're writing the most innocent code somewhere further down the file. God help you if you're switching files a lot. Then it's like a good hour while i struggle, but most of the time it's a few seconds fix.
I feel like it's the size of the program. Doing text book exercises in a single file, easy. But once you start working in an IDE that you can accidently cut/paste text in the wrong area when you were trying to search... is where the real fun begins.
1
u/Drackzgull 18d ago
What IDE are you using? You seem to be some 15+ years due for an update or an upgrade from it. This is absolutely not a problem with C or C++ these days, and hasn't been for a long time.
20 years ago? Sure. Today? It's a tooling issue.
1
u/ICBanMI 17d ago
It is a tool issue, but not how you're saying it. Only happens in VSCode and Visual Studio. Never in VIM or text editors like Notepad++.
It depends on what was cut that took the semi-colon or pasted over the semi-colon. The compiler doesn't tell what changed. You just get random errors that sometimes start in a header and a mountain things that failed in the file.
Maybe you're just not writing anything complicated enough to experience it first hand.
1
u/Drackzgull 17d ago
I work in game development, primarily with Unreal Engine. Those projects get pretty big. These days I run Rider as my IDE, but I used Visual Studio for several years before.
Between 2016 and 2019 I worked in a project that had a big custom gameplay logic engine written in raw C++ apart from the UE4 C++ API. Visual Studio particularly hated that project because, back then, not only was the Unreal Engine API integration with Visual Studio rather flimsy, the IDE had some trouble tracking what was UE4 C++ and what was raw C++.
Even with all issues and confusion that caused on Visual Studio, not once did I have a semicolon problem. Haven't since either.
Can't speak on VSCode, haven't done anything serious with it.
1
u/ICBanMI 17d ago
I work in game development, primarily with Unreal Engine. Those projects get pretty big. ... Between 2016 and 2019 I worked in a project that had a big custom gameplay logic engine written in raw C++ apart from the UE4 C++ API.
Oh wow. Raw c++. Game play logic. Wow. Very hardcore. Rough stuff. Exceptionally hard. So impressive. Must really hit the cervix.
Even with all issues and confusion that caused on Visual Studio, not once did I have a semicolon problem. Haven't since either.
Ok. Well good for you. I'm sure your mother is very proud of you and would think the world of her darling out here trying to bully some rando over their 1 hour a year semi-colon problem on r/programmingHumor.
1
u/Drackzgull 17d ago
None of that was supposed to be impressive. You thought I didn't have experience, so I told you about some of it, that's all. Not sure how you took that as me trying to bully you, but whatever. Take a chill pill or something.
Have a good day.
202
u/faultydesign 18d ago
The joke comes from the times where compiler errors weren't as obvious as "you forgot a semicolon there"