Actual reason this got highlighted as an error is because this file was missing includes so it just kind of highlighted everything else in that file as an error, apparently
Cannot confirm. C definitely supports having a single character in a string.
Unless you mean you can't have a string that's only 1-byte wide, in which case, that's just the empty string. C-strings are null terminated, so you need n+1 bytes to store a string that's n characters wide.
C-strings are supposed to be null terminated. This is, especially in older code, not guaranteed, and will cause you to feed garbage strings into things which want null terminated strings. The compiler does not check this. Be vigilant.
That is exactly the problem and why std::string is recommended in C++. C cannot make sure your strings are null terminated because there are no strings in C outside convention. Too many people assume char* means "string" when it really does not.
They probably ship their commits on floppy disks that a team member would be in charge of collecting before copy pasting the code provided at the right sections of the code base.
I worked on a team once that just used a windows file share as our code repository, and anytime we'd make a change in prod we'd copy and paste the changed lines of code.
I was the first hire on my team in over 12 years, everyone else had no formal education of CS, and the entire codebase was written in perl over probably the last 15 or so years. I tried to get us to switch to bitbucket, add some pipelines for deployment, and at some point even tried to get talk to the team about possibly re-writing the entire code base in python, none of which happened in the 1.5 years I was there. Then I left.
It seemed to me like no one wanted to take the initiative to learn new technologies, and everyone was also significantly older than me, all at least 15+ years, while I was a new grad, so my voice didn't go very far lol
I would agree, but I couldn't even get them to switch to an actual version control system, so I was just trying to get them just to learn something more modern to reduce code complexity and stop wasting our time fixing bugs that were caused by a completely unmaintainable codebase. Files with thousands of lines of unreadable code, hundreds of non-normalized SQL tables on an oracledb server that was running at the time a version that was completely no longer supported. Soooooo many PL/SQL scripts to duct tape issues in the perl so that we didn't have to re-write the perl itself.
Regardless I wasted an entire year and a half there being relied on way too much for a new grad being paid $55k a year. It was honestly just a trash fire, whether or not I had asked to re-write the codebase :p
That said I can say I learned a lot of what NOT to do, that's for sure.
I’ve been programming for 40 years and I run into this. People unwilling to change or grow. I don’t get it, it’s the new stuff that keeps our job interesting
There are also stories going around about code intentionally written by disgruntled employees to break at some point down the line in a similar manner.
Bad idea nowadays though, since it should be traceable through the version history, and then potentially become a legal issue.
Then again, there are plenty of stories of people having untracked access to stored procedures in databases, so...
This might be an example of the dangers of "no magic numbers" rules.
I've seen many examples of this over on thedailywtf.com, that were caused by people misunderstanding the rule and using names like ONE, TWO which not only make the code harder to read (e.g. is it 1? 1L? 1.0? Does it even matter here?), but also tend to lie (#define TRUE 0).
Microsoft decided it was a great idea to make the CSV format in Excel depend on your locale, so you could end up with a CSV that used ; as delimiters. It's not like anyone would ever need to send a CSV to someone speaking a different language, right?
Microsoft's localization policy is just plain stupid, in my language, about half of Excel function names are localized, while the other half of them is in English
I'm talking about older versions of Excel (I mean, they probably still do). There are ways to make sure Excel can open them properly regardless though.
Because combining encryption with compression either makes compression useless or encryption vulnerable. Depending on the order.
Compressed and then encrypted files are vulnerable as the size of the compressed object gives us information about the data. It is not extremely concerning for a database I will admit
I was thinking encrypting the data within the db file (in-database encryption), as well as the disk level. That way, if the volume is ever decrypted or copied to an unencrypted volume, you still have some protection
Maybe it’s outputting strings in CSV format and replacing commas with open paren so it doesn’t fuck with the format, with the understanding that the open paren will be replaced with a comma when being read back in? A stretch I think maybe.
To my knowledge, the ? character isn't used in Greek since they use ; instead. You might be getting it confused with the ς character, which is just the σ (or s) at the end of a word.
I think I actually know what this is for, let's say I had a vector v, and I wanted to print it nicely. I could do for x in v cout comma x, then change comma to , and after the loop cout ) and it would print the iterable in (,,_) etc.
Doesnt mean I agree with it but hey a reasons a reason
423
u/uruharushia Jul 20 '21
turns out apparently this is actually new code (few months old or so)
what even
343
u/stahkh Jul 20 '21
Even the text editor complains about this monstrosity.
438
u/PM_ME_ADVICE_PLEASE true || !false Jul 20 '21
i don't know( looks fine to me( what do you think?
116
u/lotanis Jul 20 '21
Years ago I had some weird behaviour on a serial interface that just made no sense until I found this line of code:
209
u/NekkoDroid Jul 20 '21
( ͡° ͜ʖ ͡°) git blame, no hiding from me
73
u/Busterx8 Jul 20 '21
Gotta be a sadist to write that
21
u/moshgreen Jul 20 '21
This is satan in a carnival dropping lollipop bombs for young children to collect kind of evil
58
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Jul 20 '21
Image Transcription: Code
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
17
u/QuantumG Jul 21 '21 edited Jul 21 '21
I once worked with a German guy who had this in the code base when I arrived:
#define ONE 0#define TWO 1#define THREE 2...
all the way up to NEIN!
15
u/R3D3-1 Jul 20 '21
This might be an example of the dangers of "no magic numbers" rules.
I've seen many examples of this over on thedailywtf.com, that were caused by people misunderstanding the rule and using names like
ONE,TWOwhich not only make the code harder to read (e.g. is it1?1L?1.0? Does it even matter here?), but also tend to lie (#define TRUE 0).42
u/ign1fy Jul 20 '21
Client: I need a tab-delimited text file with a ".csv" extension.
Me: do you even know what CSV stands for?
I bet this was code for one of those clients.
27
u/choseusernamemyself Jul 20 '21
that's how you know your friend smokes weed duh
7
u/ab0ttskytimes Jul 20 '21
Maybe it’s outputting strings in CSV format and replacing commas with open paren so it doesn’t fuck with the format, with the understanding that the open paren will be replaced with a comma when being read back in? A stretch I think maybe.
8
u/noop_noob Jul 20 '21
is this like the greek question mark thing
3
u/[deleted] Jul 20 '21
And renaming the variable causes inexplicable errors because somewhere the code reads itself
3
u/sleeptil3 Jul 21 '21
Classic Oxford Parenthesis debate to follow.
4
u/[deleted] Jul 20 '21
What( looks totally normal. I always use the "(" as a comma.
2
u/LMCuber Jul 20 '21
Red underline be like are u stupid g
4
u/techek Jul 20 '21
Only two things about programming are hard:
That variable should have been named what it is used for and not what it contains ... which reminds me that maybe I should take that pill too. 🤓😜
2
u/CopperyMarrow15 Jul 20 '21
ah yes( my favorite punctuation( the comma!
1
u/Yangishrobin Jul 20 '21
Please tell me you're not serious. Please for the love of all that is holy tell me this isn't real.
1
u/Biggergig Jul 20 '21
I think I actually know what this is for, let's say I had a vector v, and I wanted to print it nicely. I could do for x in v cout comma x, then change comma to , and after the loop cout ) and it would print the iterable in (,,_) etc.
Doesnt mean I agree with it but hey a reasons a reason
1
u/element_4 Jul 20 '21
Is there any reason why you would need to do this?
1
u/Svani Jul 22 '21
Seeing that in some random codebase is bad enough. Seeing it in the codebase of a multibillion-dollar corporation, and in performance-sensitive parts no less, is enough to facepalm one's eyeballs out.
1
u/[deleted] Jul 22 '21
Don't change it ;-;
1
u/thomasa88 Jul 27 '21
sleep(3800)Please don't use magic numbers
We need the code to wait for one hour.
1
u/TrustMeIWouldntLie Jul 20 '21
define true false