Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "c code"
-
In my second year,
I told my teacher I can code in in C#(c-sharp).
She replied : C-sharp ? Oh you mean C-hash !
*that day I lost hope in college*32 -
Was helping somebody with a little C++ issue (disclaimer: I know jackshit about C++).
After a while off reading his code and opening a file called "pi.cpp", I noticed something odd...
This guy literally thought is was a good idea to put 81663 fucking decimals of pi in a #define statement :^)
On the screenshot, that weird "noise" on the right is actually a scrollbar of the code itself...33 -
When you copy some code and select the code you want to get replaced and accidentally press Ctrl+c again so you have to copy the thing you wanted to copy again 😡12
-
Any devs here that Code in C/C++...?
Or am I lost in "webRant".
I am worried about the future " code everything in javascript " generation :)
Make pointers great again!75 -
When your delivery manager is the stupidest fuckin manager ever born :/
"If you have android code ready then why can't you create iPhone build unh - since A=B, B=C so 'C' SHOULD EQUAL TO 'A' right - so use android code and create iPhone build TOMORROW - don't change the code just create a build in 2 hours and then work on xyz project for other 6 hours since its in HIGH priority"
WHAT THE FUCKIN FUCK..
MY DICK = YOUR FACE MOTHERFUCKER :///15 -
Replaced semi colons (;) with a greek question mark (;) in my colleague's c# code.. He's now scratching his head... :D27
-
Only God and I knew what I was doing, writing uncommented code in C a year ago.
Now, only God knows.2 -
I once wrote about 100 lines of C code without compiling or testing in between in notepad++.
And it had no errors and worked.😎4 -
WRITE IN C ('LET IT BE')
When I find my code in tons of trouble,
Friends and colleagues come to me,
Speaking words of wisdom:
"Write in C."
As the deadline fast approaches,
And bugs are all that I can see,
Somewhere, someone whispers:
"Write in C."
Write in C, Write in C,
Write in C, oh, Write in C.
LOGO's dead and buried,
Write in C.
I used to write a lot of FORTRAN,
For science it worked flawlessly.
Try using it for graphics!
Write in C.
If you've just spent nearly 30 hours,
Debugging some assembly,
Soon you will be glad to
Write in C.
Write in C, Write in C,
Write in C, yeah, Write in C.
BASIC's not the answer.
Write in C.
Write in C, Write in C
Write in C, oh, Write in C.
Pascal won't quite cut it.
Write in C.6 -
This morning finally pointers to structs in C finally clicked on my mind!!!🤯
80% of the C code that puzzled me now makes sense!! 🤗12 -
Started learning C++, coming from Python.
Just spent ~25 minutes searching for a problem - My code wasn't working like I expected.
Problem: Didn't compiled the program, kept running old code, didn't noticed8 -
HOLY FUCK I DID IT
I wrote an Arduino code for my friend. I didn't have any board at the moment to test it, but he flashed it the next day, and EVERYTHING FUCKING WORKED!!! AT THE FIRST TIME!!!10 -
I skipped class in high school and went to the library where I tought myself C++.
Because code was marginally funner than history class.4 -
My classmate was debugging c++ code when he stepped out for a while. We deleted a closing bracket.
He is rewrote the code from cratch7 -
There is no reasonable excuse for doing anything less than your best.
- Robert C. Martin, Clean Code4 -
My code review nightmare is reviewing C++ code that was written by Matlab people. Letting them commit code without reviewing it will surely bring Armageddon, but having to watch these horrors...
Functions signature like 'void func(int arr[3])'. Nononononono.21 -
Don't be lazy when naming things. You yourself will be lost in all the a, b, c, ds, let alone your code reviewers.4
-
why i like c#?
1- easiest way to build a program with good GUI. just put some XAML code and it's done.
2- I love syntax of c#. it has types. god I hate php XD
3- C# is also fast and strong.
4- don't forget the .net framework that has almost every thing I need.
3- A god like IDE, the Visual Studio.36 -
So this guy was struggling using grep everywhere for navigating C source code. What a douche. Told him about ctags. Made my life easier.1
-
Are you a C# developer, and do you want to contribute to the devRant public api C# variant. This is your chance!
Fork the code and help the community project.
https://github.com/WichardRiezebos/...7 -
Anyone watched 'Jhonny English Strikes Again'? This is the code that drives the exoskeleton... I guess it just needs a random number to work. 😂😂3
-
You know it...from the introductory page of "Clean Code" by Robert C. Martin.
Which door represents your code?2 -
Damn fuck it. I am making a program with
#include <windows.h>
Accessing the Win32 API in c is such a pain. Just made a simple window with 70 lines of c code. And I have to edit it in turbo c but run it in some other compiler. Our teacher is a .... uhhh
Hate projects.
Sorry if the rant doesn't make sense. I am too tired.11 -
This is next level shit...
My friend in college is always sending me his C code for debugging IN FUCKING .odt!!
He even highlights the syntax.5 -
Do you guys know any Github repos with really Bad C++ code?
Just wanna see if I can understand it, as a test... 🤔9 -
SeniorDev: "If we were only allowed to use C# 6 features, we could reduce our code base by 30%"
- other devs nodding their heads in agreement -
Me: "So, are you going to change our entire code base to be C# 6 compliant?"
SeniorDev: "Uh, oh hell no."
Me: "So those C# 6 features are going to reduce our code base by 0%?"
SeniorDev turns around without saying a word.
Getting a bit awkwardly quiet now. Better watch my back.4 -
I was teaching my fiancée how not to write duplicate code. After a while of me ranting about why you shouldn't do that she made a dostuff() method and dumped all the duplicate code into it.
I kinda like the result of that.
On that note, i finally made an account after lurking here for weeks. So, Hello!1 -
Hello, I can code a "hello world program" in Java, Python,C,C++,C#,Ruby,nodejs and in HTML do I qualify to be here?5
-
What the f...
minified and obfuscated javascript code is more readable then the c# code of my colleague jeez...👹😡 what the f4 -
I found this cool C code that prints map of India. But code went straight over my head. It looks cool though!
Here's the code if can explain!!
https://gist.github.com/Deepamgoel/...3 -
If you're having a bad day, know that my friend broke my C++ code by replacing one semicolon with a Greek question mark.
I retyped the whole code before he told me. :|5 -
The more I play with C, the more I realize why many people hate C++.
I like the amount of control and the simplicity. No unnecessary syntax sugar, and the code is very straightforward to read.11 -
I do think C# is the best language going. It's basically got everything, and VS is, weirdly for a Microsoft product, among the best IDEs. You get to thinking that it's actually harder to write unorganised code than not with it: it becomes difficult to imagine writing messy, repetitive or spaghetti code in C#.
Then you use Unity.24 -
Hi, some time ago I was looking for a good app on Play Store and Bam! I found devRant. I opened it and the first rant I saw was from aswinmohanme. It was an image of Marilyn Monroe, but somehow created with circles, hope you understand me. I thought this is a great opportunity to test my dev skills so I opened Visual Studio and started coding. Today, after 2 days od work, I finally done it. It was written in C# and I have to say, I'm very proud od my child :^)
Link to repo on GitHub:
https://github.com/adampisula/...
In Debug directory there are some examples of this on action. If you're working on Linux just build this solution with Mono.4 -
Using an array of function pointers to replace large switch statements... holy shit.. I feel like Thanos getting the time stone.
Just when you think you can’t get your code to run any faster, nor did I think I could get the code any smaller... BOOM.. C never ceases to impress.
Next I’ll be turning this into “object” oriented ... but since it’s C ... it will just be Struct oriented .. SOP ..18 -
C is nice and all but have you ever had to massacre your code with preprocessor instructions to make your code portable?3
-
In C# you are not able to do bitwise operations on generic enums so you have to cast them to an integer via object... 😐 Apart from that, this awesome code shows what C# can do 😊7
-
I had a genuine respect for C++ developers back in 2001
Then this whole STL thing happened. Then C++11, C++14....C++17
Me now: Bitch do they even write code 🤣🤣11 -
I finally have a storyline for my game and it's pretty interesting..
Now I dont know what software to code the game in :c33 -
That moment when you replace
If (blablabla) {
return Yes;
}
else {
return No;
}
with
return blablabla;
And it not passed code review because "We should have readable code"2 -
90's programmer used to code in turbo
C and ms-dos. Nowadays ide also make us frustrated sometimes.8 -
rant!
Gets hired as a C++ programmer. for the past weeks I have been designing UI interface without writing code.
#FML9 -
Being a programmer in a scientific discipline can be infuriating.
using "no one" ="almost no one"
using everyone = "almost everyone"
1. No one knows what even the very idea of good practice is. And everyone refuses to learn. 3k lines of repetitive copy pasted main. 500 lines of plotting method.
2. Raw C-style pointer based array creation. Won't use develope array libraries because what if development stops. FUCKING HAVE YOU SEEN YOUR CODE WHAT IF DEVELOPMENT ON YOUR CODE STOPS. FUCK.
3. LOOP VARIABLES DECLARED AT THE BEGINNING OF THE METHOD WHY.
4. Everyone wants to make modular, independent code. No one wants to use OOP. NOPE. ALL IN ONE FILE. WRITE C++ LIKE A FUCKING PYTHON NOTEBOOK. FUCK.
5. LIBRARIES OH MY GOD PLEASE DO NOT CODE UP YOUR MATRIX MULTIPLICATION. PLEASE DO NOT TRIPLE LOOP IT. NO. THE LINEAR ALGEBRA LIBRARY WILL STAY IN DEVELOPMENT.
6. Please realize that literally not one comment over an 1800 line file does not help anyone.
FUCKING. WHY. WHY ARE WE SCIENTISTS SO GOOD AT SCIENCE AND SO FUCKING SHIT AT THE CODE THAT MAKES OUR SCIENCE HAPPEN. WHY. FUCKING. WHY. FUCK.undefined rage no comments scientific computing fuck this shit wall of text bad code science fuck c++ fucking4 -
!rant
The more I learn about advanced C++ the more I love this language. C++'s template system is so insanely cool!
Just made a proof of concept expression templates based linear algebra library for my own projects. It was actually a lot of fun to make, and seeing it spit out optimized, loop-fused code with no temporary variables...magic.
Long live C++.7 -
Found my old code.
You gotta admit, that's some clean code there, considering I learned C# only for a year at that time.
But those comments....
VeRy WeLl WrItTeN, vErY dEtAiLeD, vErY gOoD8 -
So i helped my friend write a program and i sent it to him. The next day he told me that the code dosent run, so i asked him to show me the errors and apparently he thought C and C++ is the same thing and was trying to run my C code as C++ code...5
-
What if you use C++ to implement C++ code into C++ so you can have a better version of C++ called C++++?6
-
Visual Studio (Code)
-Cross-Platform App Development
-Cloud Integration
-Extensions/Packages
-Lightweight (Installer VS2017)
-Many of Langs (C#, js, Python, F#,...)
-Data Science Tools built in
-...6 -
#You never know the sun will rise. I recommend this code style.
a = 2
b = 2
c = a + b
assert a is 2 and b is 2
assert 2 + 2 is 4
assert a + b is c
assert c is 41 -
When u spend too much time writing Java and suddenly go back to C# yet continue to write Java code 😪4
-
Ever happened to you?
With me, it always happens when I code !! LOL 😂.
Favorite language C++, tell me yours.9 -
You know you have a quality teacher for C code when you are writing a test and you have to write the code on a piece of paper4
-
So, today I tried using my C/++ Code in Java using native jvm stuff.
It's cancer to make it work but damn it's cool.4 -
The reason I don't have friends is because I embed Python code in C++, instead of using pybind like the Linux gods intended us to 😅
If you want to load data from Pandas DataFrame in a C++, I can put some examples on my Github.6 -
I need to do codereviews at work...
Everytime i get c# code im just happy, it's beautiful to look at, easy to follow, new language features every couple of months or so...
And then I get Java/Android Code.... 😩☠🏃♂️🏃♂️🏃♂️🏃♂️🏃♂️.
(I mainly code in C++)3 -
Today I got a segmentation fault in C#.
No pointers. No unmanaged dependencies. Just managed code. Seg fault.
Uhhhh...20 -
Me: For Christmas I want a unicorn
Santa: Be realistic
Me: Okay I want to write safe code in C
Santa: About that unicorn...12 -
I was trying to understand the source code of aircrack-ng which is written in C today.
Suddenly I saw sth strange !
WTF !! what is #ifdef ??? I've never seen that before !
So I told myself : hey ! You have to download a complete C programming course!
so I did , but when I skimmed through the titles , again:
WTF ! I know all of them! So why the fuck I could not fully understand the code ? Where can I find anything I missed ?
So... I'm asking U :)14 -
I said "Let's use C for this year's hashcode challange" as a joke.
Guess who's writing C code tomorrow3 -
I am writing much less code for certain things in C++ than I would in Go...
I guess that sticking to traditional languages has its advantages. ;)9 -
Do you sense something weird on this dead simple code?
The teacher showed a similar code recently in my C class. It was weird to me since I know C for years. I want to know what you guys think about it.22 -
I took over someone's code right after they left, and this was in there... By the way the containing method was about 300 lines long.7
-
So I integrated the second Lidar, and did a small quantitative evaluation - the localization succeeded in 133 out of 135 scenarios.
The next step is to tentatively port all my python code to C++. So I started this today, and while I always hate on Python and say I like C++, porting all this code looks so damn painful....10 -
Oh my god my brain is hard wired to write c++ in snake case. Spent 4 years doing it. This code base uses camel case.9
-
When you can't hack even a toaster so you use www.hackertyper.com to look cool at school but as you "write" the code you realize it's probably written in C or C#...5
-
When reading through someone else's code, what about it made you think "Damn this is well written" or similar?
Any language - I have a bias towards PHP, C++ and C though.9 -
So which are you new year's resolutions?
Mine are:
Learn C,C++ and Node
Organize my time to do more with it
And code5 -
What is it with certain colleagues who "wanna write C, not C++"
Motherfucker if I see another malloc in the code I will physically asssault you.
Like damn we're failing to teach people C++ badly when a newcomer from university, who had 2 semesters of "C++" doesn't even understand RAII.
And how in gods name do software engineers with *decades* of experience get so stuck on old technologies?
Like I've seen them write 3 nested try-catch to make sure a delete is called or some mutex is unlocked....
If youre in the position of teaching others C++, please stop teaching C first.25 -
When you're the only one in the office that codes in C++ and you get this email -- legacy project code here we come.1
-
I had to implement an internal tool in C++ which parses a file and converts the content into another format.
It did take hundreds of lines of code to get it working, file handling and parsing data in C/C++ is terrible.
I'd rather done it with some scripting language, and additionally implemented it in python as a side-project (in less than an hour and < 20 lines of code, BTW) but it should be C++ "Because that is how we do it here".
At the end the tool was only used for a few weeks, because someone had an idea how to completely avoid the need for that converted data.3 -
well, fuck... how about everything that works in visual studio but feels like garbage in VS Code???
don't get my wrong I use VS Code for every other language... but C# has just always felt better in visual studio than in VS Code. oh well13 -
I think I've reached peak boredom, can't work on my main project so I'm sitting here going through nano's C source code and planning to port it into C#...
Send help pls....3 -
my frontend colleagues always keep amazing me with their create way of writing code:
```
const input = "a";
const result = {
"a": () => console.warn("A was selected"),
"b": undefined,
"c": () => console.log("hello")
}[input || "c"]?.();
```
Poor man's switch construct ... (facepalm)16 -
Binding a C-library for a higher-level language:
10% Actually binding Functions and Types to their higher-level equivalents
90% Writing a fuckton of wrapper-code to secure that dangling pile of C that could collapse at any time -
> grep -c -e '// BAD HACK:' importantproject/src/main.cc
4287
our most important piece of legacy c++ software with about 44 thousand lines of code and next to no doc aside from inline comments.4 -
That time when I wowed all my colleagues with C++-code that executed over 2.5x faster than theirs, without changing one line of code.
I guess they didn't know what -O2 does (or that it exists, for that matter).7 -
What the hell did I miss?
I've been seeing lots of dev communities joking/not joking about replacing C++.
Did we somehow replace all C code in literally every embedded product overnight?10 -
Our team had a brilliant engineer, he made a tool that would convert IBM Assembler code to C, comments included. the comments are the assembler code. bleh
-
How old were you guys when you started writing code? What language and what inspired you?
My first programming memories come from writing some QBasic text-based RPG and graphics demos when I was like 12. I remember moving into C/C++ soon after with Borland's C++ compiler and playing around with WinAPI and OpenGL 1.15 -
I'm a big fan of super-modular and flexible code, but my colleagues are huge fans of Ctrl-C / Ctrl-V.1
-
Guys, a company's HR mailed me for a position that requires strong experience of ">3 years in Python with C or C++".
Does it mean Python and C/C++?
Or do they need someone who is using C/C++ to write Python?
I have some experience with adding Python support to C++ code. Does it count? 😁8 -
A stressful day trying to untangle some speghetti code I wrote a while back.
On train home. Time to relax
By programming some C code. -
Trying to understand other people's code like:
- 6 README, in total 7 lines (that's all there is for documentation)
- 40% of code is commentary like (original code, not altered...)
// if(a = b)
// c = d; // this is not working -
For a long time I was of the opinion that pointer variables in C/C++ should have the asterisk immediately after the type name (e.g. int* foo).
Eventually I became convinced that it makes more sense to have it before the variable (e.g. int *foo).
Now I find routines that return pointers look weird, e.g.: void *allocate_something() so I am considering adopting the original style I used.
The only advantage of having the asterisk before the variable name I am aware of is that it is easier to remember to add an asterisk if you define more than one pointer on that line.
Anyone else find it hard to settle on code style guidelines for their own personal projects?12 -
Ugggh. Has anyone else on here worked with MFC?
I've been updating some legacy software and it's been like wading through a swap that was caused by a malfunctioning trailer park septic system: no map, and mostly shit with the occasional nasty surprise. -
I've been writing Java the last few days. Really makes me remember why I enjoy writing objective c / swift so much. It's not necessarily the crazy syntax of objective c. It's the conventions behind the languages. It's very easy to make your code read like prose. Which when you become used to this it's very hard to jump back into spaghetti code with abbreviated variable names and such.3
-
Need a C++ partner..
I'm self taught developer and it's kinda hard to understand the code of your own.. since c++ is not an easy language to master I need partner whom I can easily discuss code and topics of c++. I'm in slack too and it's great community .. has people who always willing to help you out.. but the thing is it's really weird to ask simple question there again and again.. so i wanna have some partner to discuss C++ code easily..13 -
I'm writing c# code, does not work, wrote the same code in python just to see if I'm thinking the wrong way, nope, it worked in python then fixed the c# code...
I might be a c# racist or I don't know.2 -
So I've been maintaining our company's web products for a few years now with a great senior dev, but why would it ever make sense to have a
bool somebool = returnsBool();
if (somebool == true)
...
WTF?!?! I still fine them in the code to this day.6 -
Talking about adrenaline sports in a class and our favorites.
Me ? Writing C code without checking for null pointers!
What about you ?1 -
It's only Monday. Why do i feel so tired. T_T
Today's work:
- 3hrs check point meeting on Project A
- quick API fix, testing and dev assistance on Project A
- prelive deployment of Module B
- code review and enhancements for Script C
- prelive deployment and testing for Script C4 -
The ratio of time spent reading versus writing is well over 10 to 1. We are constantly reading old code as part of the effort to write new code
- Robert C. Martin2 -
When my shitty c# code actually fucking worked.
Even changing like, the most simplistic things with a mod for a game is an accomplishment. -
When I was an apprentice in a small company, ...
my boss told me that his company would never ship release builds, because the "evil optimization option" is responsible for breaking his code.
My first thought was that it wouldn't make any sense at all. The default option for code optimization is always set to zero.
After investigating his code, I found out that he didn't care to properly initialize his variables. The default compiler option for debug builds did implicitly initialize all variables to zero. After that I've confronted him with the fact that implicit null initialization does not conform to the standard of C and C++. He didn't believe me what I was saying and he was questioning my knowledge about C and C++. He refused to fix his code to this day, so he keeps building his libraries and applications always in debug mode.
Bonus fact: He would never build 64-bit applications, because his serialization functions do get incompatible with exisiting file formats. -
What would be your recommendation to Code in c++ to challange him besides a fcking Hello World Program.6
-
Me compiling c++ code at 3 am be like:
gcc filename.cpp -o filename
Some error pops up
Cries for a while, looking up for the solution
After writing the whole code again notices was using gcc instead of g++... -
Once upon a time i have seen a block of code in a while (2 > 1) ... it was in C (or so i remember), but still...2
-
Anyone here knows whether this is valid?
This is the default code for a new Visual Studio C++ Console Project.20 -
when you're tryna create a function in C and u start typing "funct"... and then u realise it's "C" so u backspace your code of shame.
-
Why are you trying to multithreaded c++ file i/o? If you can't write c++ code that's faster than your hard drive, please just don't write c++.
Literally no complex calculations, just some insane string formatting.10 -
Rant C++
Why do some people like to use ALL the language features. lets use "auto" en "std::tuple" and "std::tie" to hook everything together.. I cannot put something In a list because I now have to use std::move. SURE! If for every line of code I need to lookup what things were again or fixing compile errors it breaks my flow. "std::bind" this and Template that. half of the stuff you don't actually need.. it just complicates things..
Not all are bad. Only Unnecessary sometimes.7 -
If I ever get asked to write code in C for a contract again. I am going to use the llvm C++ to C compiler. Then deliver the machine generated C code to them.6
-
I hated Java and was skeptical about C# in the beginning (I never code in C# during my early college years).
But when I tried coding in C# as a requirement for our internship this month, I was like "fuck Java (seriously), C# is the shit!"1 -
Feels like every damn day I'm learning about another language feature that we CAN'T use... So much legacy code everywhere.
C# is more like C-blunt at this point.2 -
Want to write WebAssembly code with C/C++ without the hassle of setting up the ecosystem on your machine?
https://github.com/wasdk/WasmFiddle -
Microsoft C/C++ code keeps on giving:
https://msrc.microsoft.com/update-g...
Too sad, that Microsoft is too poor to afford good devs. As a lot of devs here are sure, that good devs surely can code safe and secure in C/C++, Microsoft probably just lacks the resources to get such devs to work for them.13 -
Getting back to the cpp applet I started somewhat recently (Vanilla + Gentoo kernel version checker)...
Me: "debugging c plus plus code"
Dictation: "f***ing c++ code"
...
Well, it's not too far off. -
It's my birthday and....
if(Birthdate.Date == DateTime.Now.Date)
Console.Writeline("HPD - Muli");
else
Console.Writeline("Try again Tommorow");3 -
Error. File not found: C:\somedirectory\file.txt
*opens C:\somedirectory\ * *looks at file.txt*
*runs program again*
Error. File not found: C:\somedirectory\file.txt
*changes directory it is looking in, copies file to new directory*
Error. File blank: D:\somedirectory\file.txt
*cry... no it isn't*
I just need to deploy this contractors code... supposedly it ran on another system, but the endless Spring configs hate me... :(9 -
I learned to code by trying too automate things. I started out with Windows batch and moved up to Java before I discovered the magic of C, C++, Python, and now Swift1
-
My company ex-IT Maintainer, left a long automation script in c++, bit of python 2, and bash for our server which developed long before i went to junior high school. and now, the system is outdated, and have a compability problems. so i got task to give it a fix.
when i opened the source code up. i was like; holy shit who the hell write a code especially c++ all aligned to the left, Yes All of it, not a single line are indented. but in the other side the code seems maintainable, and after autoformat, autoindent and couple of fix later, it was readable. I am just wondering who the hell in the world write a code with a style like that ???? i knew he was aware of code style and indentation since he wrote couple of python scripts. Unbelievable.
sadly i cannot show you the pict cuz of company things. -
So in our last retros some of my colleagues suggested to (forced) limit the number of lines per method in order to "maximize our code quality".
In the one hand I can see the benefits of this, such as easier testability when having more sperate testable blocks of logic.
But on the other side their code contains lots of such one or two lines private methods which get most of the cases not more than one time called. (And which I then can't even test separately)
I don't understand how this should help...
Is this really a thing? Am I just not "clean" enough?
(it's c# btw)3 -
So at one point I worked on an inherited project that had the worst code I've ever seen. I mean bad, so bad there may no quantifiable measure that can accurately convey how bad. We ended up naming the thing 'the hydra', cause it had a million issues and they just kept growing as we fixed things. To my point, in C++ they implemented their own primitive type Boolean32 as a signed int32 pointer. If that wasn't enough they used it as an octal bit mask. They also switch the value using logical and / or between 2 numbers, 037777777777 and 000000000001. So essentially they only switch this value to 1 or -1 and end up comparing it to their own const true or false. In c++ any value not 0 is == true...apparently not in this code.undefined octals why me? why would you do that? terrible code awful code c++ coding no designs bad code
-
If you ever try to learn C++, give C Primer Plus 6th edition book a try. This is one of the best books that are prepared to teach, not tell about C++.
I tried Bjarne's boooks, but damn they are hard to understand, with badly formatted non-monnospace font code examples and terrible technique to teach. -
Hey, I'm looking for some C# programmers to watch code. Do you all have any suggestions? I don't care which streaming service they upload to.7
-
Me: ChatGPT write me a secure NGINX config which does...(continues to explain project details)
ChatGPT: Here. it's simple and it does all those things.
Me: Reads code. Looks at my code. Reads more code. Looks at my code. Squints in concentration. Ctrl + A Ctr + C.3 -
Following this c# course on the web.
The dude says to always use the for exampoe instead of the while.
To produce fewer lines of code, and to ensure not to use the variable "i" wrongly later on.
Thoughts on this from you C# masters?21 -
I bonded a lot with a co-worker over the last several months as I had to mentor him in iOS and how to maintain our apps. We mostly bonded over how much we hate Objective-C and the management of the project. Now we are buying Christmas presents for eachother. Bad code brings people together
-
I am new to this world and I am wanting to learn c++ can anyone recommend me a site like code academy? Thanks.8
-
One thing that is really difficult is when you are writing let's say C code for months, and then you switch to C# or Python, you immediately use C-style logic and forgo the easier, shorter Python syntax!
I did a python kata on the Codewars website. After submitting it, I realized my solution was like 10x longer than every other solution. Talking about hand in face.
Stuck to basics and forgot about Python's amazing shortcuts. What are you going to do!1 -
From today, I'm gonna post infrequent-devLogs of the project i am currently doing, I have been thinking about it the past couple of months, and I am finally moving it into action!
I wish writing devLogs will make me to finish the project, at least a working prototype.
It is a C# block coding application that is made in 100% C# that generates human-readable C# code for C# begineers.
If you want to follow me along, make sure to subscribe to my rants by going to my Profile (cozyplanes) > More icon in top right > Subscribe
All devLogs posted directly via devRant API integration from CZedit, a simple edit program for geeks
=========================
devLog #0 - Block coding in C#
Done:
- Made the console output to redirect to textbox
- Ability to save output to external storage
WIP:
Compile C# code directly at runtime with Roslyn
Notes:
open-source??5 -
I wonder the creator of jQuery , Objective C , Erlang, what were they smoking while creating these programming languages......
Whenever I code in Erlang (server side) or Objective C (iOS) I can feel that the creator is damn high...
Objective C is weird that I have to call an object by allocation . Like get me thinking is that OOP? Or Functional.15 -
Someone just told me he writes c++ code and wrap it with swig so that he doesn't need to learn Python. Why man, just why!?
-
Serious question, which language would Iron man rather code in? The billionare genius may have too little time to write his whole infrastructure in C/C++. My bet is on Python since it provide every feature a super hero, who has lots to do might need16
-
A bit confused
I have a code and it is giving different answers in different language and compilers
the code is
Int a=4
Int b = ++a + a++ + --a
Please ignore the syntactical errors
But this logic give different answers in different compiler and language like in
C(turbo c++ compiler) it gives 12
C(gcc)- 16
Java- 15
Python- 12
Can anybody explain the logic behind this...10 -
The other day I was working with libpulse in a Qt project. Because I didn't like to deal with a C library from C++ code I copied wrapper code from a well-proven project. Suddenly the wildest compile errors occurred when I only tried to include a header from the new code. After hours of frustration towards me, C++, the compiler and everything involved I discovered that one of the headers I copied had the same include guard as one of the existing classes.
-
I know that there is no bad programming languages.
But there are one exception.
Swift 3.
You can't use c styled code! Why????
Wtf???
Do you have anything against C?
If you do, why?1 -
Need help. Explain why assembly code is wrong.
C code:
long f(long n) {return n + 1} ;
Assembly:
f:
movq rdi, rbp
addq $1, rbp
movq rbp, rax
ret6 -
IDK why I get annoyed by underscores before private member names... Is i it useful or just an old relic?16
-
Every time I try and write C++ code, I end up getting annoyed with my approach and trying several different ways to structure my code before giving up and reverting to writing the exact logic I need in C.
It is most likely due to lack of experience with writing C++ programs, and one day I'm sure I will finally work out how to apply the right patterns at the right time and find it quicker and easier to write good code. But for now, I use C since it is very easy to bend into whatever shape I desire.4 -
💻 Four months ago. 💻
The Systems & Networks's professor said "You've to do a program that simulate the ARP table, in C."
...
After one week I had done the program!😎 (About 400 code lines)
And the rest of the class?
... One week... Two week... Three week.
Somebody had done the program, somebody else no.
Have an "informatics-stupid class" is funny and makes you look smarter. 😂🔝 -
Working now 8 months at a company. (C++)
Every feature becomes a refactor and a code clean
Every bug becomes a refactor and a code clean
Every Refactor becomes a code purge. :/1 -
<sarcasm> best advice?
Write microcontroller code in C++ even if the underlying OS won't understand. You can always decompile the program to C code and use the generated code.
Things he forgot to mention:
- cannot use most of C++ core functionality (basically no STL, no exceptions, all of C++11)
- have to get your code to compile twice (C++ and C afterwards)
- debugging that generated C code is a pain in the ass
- have to debug twice -
A DSA teacher who didn't write a simple line of code in class. No, not even the pseudo code. Teaches us A,B,C,.. in class and expects us to sing songs during the exam.1
-
Interned at a company where i was developing desktop applications and also taking care of user support (general user support, nothing to do with the software i was developing).
Do you know how frustrating it is to get off your desk and leave an unfinished line of code just to go and find out that the 'my computer froze' issue was simply an improperly plugged in mouse. 😠😠
Fart on you user2 -
Install .net -> install vs code -> install C# vscode extension:
extension not working.
Great job Microsoft!
Booting back to Linux partition.11 -
When I wrote count++ in Python and got syntax error. Darn!!! I just applied Java and C syntax again!2
-
First Rant...
Why the fuck do I get on a C++ interview the question if I now Javascript......everytime.... NO I DON'T WANT TO KNOW JAVASCRIPT!!!
Real coders code in C/C++ and not hipster javascript. Am I alone???(probably)10 -
Be me first time using python forced into it.
Get frustrated with all the syntax errors you make and Python's cancerous horseshit syntax.
Chase a weird desync problem between C code client and Python raspberry pi controller.
Make 7000 changes to the code and run out of ideas because nothing makes sense anymore.
Decide to go ahead and write C code.
Find out you've been writing code to a different file and running an older version of the code.
I'm a retatd FML don't be like me.6 -
Not finding a proper source to learn is a pain... especially if you want it free, any suggestions to learn more?14
-
If you search for c tags, the first post is c#, even with "c".
Happens on every stackoverflow search too.
This is the only reason I don't like c. If I need help with a simple problem, 50 lines of template code is not the answer ;(4 -
C is great, C is good
And we thank it for blazing code.
By it's spec we must be led,
Give us C, our orphaned thread. Amen -
Aaaaaaaarg GCC! Stop caching my failures. I do correct my code, stop pulling the old copy from /tmp you bloated piece of C3
-
somewhere in every spaghetti code there is a mysterious CTRL + C and CTRL + V that just can't explain itself2
-
Feel dirty writing in c. How do people even deal with unsafe pointer type casting/memory allocation/free? The codebase is plagued with memory leaks and there is no test.
I will just pretend I can't read c code and play dumb when shit happens15 -
So I have heard some people talk about it and I guess I can't google the right words but what do I do when building c across platforms that may have the header files in different locations without needing to actually change the c code?2
-
The moment when I wrote a puzzle solver in C.
Not the most exciting thing to write but it felt great at the time.
Before writing every line of code without thinking some steps forward I decided to write it as pseudo code in notepad.
The very moment it was converted to C it just worked, writing it was beyond pleasure, just pure bliss. -
We're using a setup with c# dotnet backend and js (React) front end... and do one in VS and the other in VS code. Any way to get one IDE to handle both properly? It's a huge pain but my manager told me that's just how they do it4
-
For the fucks sake, friend sent me code with ton of shit like that:
digitalWrite(room6,lv6);}
Is there some nice short guideline how to wire nice clean Arduino/C-based languages?5 -
Invoicing module of an old application died a few weeks back and I was sodomized into fixing it ASAP! Instead I wrote the most beautiful bit of code in history and not only half-assed a solution in thirty minutes I also revolutionized the Customs department conception of user experience.
https://gist.github.com/anonymous/... -
Code::Blocks, because why make it look nice, bother having any auto-complete functions, actually ensuring all of the built in C++ functions work and not having the need to sometimes have to be closed down and restarted to build and run the code 😤1
-
My friend said to me
X - Hey, I ca very well code in Python
Me - Do you know what are library in python
X - No, I heard this term first time1 -
Am I the only one that in order to keep C code clean has a horrible file with macros and util functions?4
-
!rant
I am starting to study next month and I will have to code in C, but I currently only know Java, C# and some python. Do you need anything coded on C or an open source project to contribute to so I have motivation to actually do something?1 -
When you wake up forgetting that break through to that problem you promised yourself that you would code the next morning because you were tired. :C
-
2014
I did some cool projects with node JS.
We had this project where we had several embedded sensor box components communicating via a node js server backend with some fancy visualization.
And one of the guys was a total idiot. His part was to write some embedded code for a sensor box. He also wrote some data receiver in C# which was a totally over patterned mess and nothing worked.
For some unknown reason this guy made me his arch nemesis. He also never liked the team. While the rest of the team actually was super cool.
So in the final presentation out of a sudden in his part of the presentation (He had a Mac and had his slides done in some nasty whatever incompatible format) he pulled out some slides with code metrics. The best part was where he compared the embedded C code with my js code in terms of cyclomatic complexity. I will never forget this moment. Some nice bar chart.
Good I loved that guy for this moment.
And that made my year! -
C- let's See
C is a procedurally developed language follows sequential method of solving a problem.
Example
If a teacher of an Institute teaching various subjects, Maths, English, Science and History.
Case1.One student comes and asks teacher to teach English
and next student to teach Maths,
And the other to teach History.
Case2.Next students comes for English
Case3.Other one for History.
So what I understood regarding C is procedural language is
It completes first case1,next case2, and then case3. (Task after task)
Here English is taught 2 times seperate
And History too 2 times separately making time and process complexity.
C is a platform based high level language support only desired platform. If I program in windows with i3 processor , it runs only on the same OS and Processor, if code is run in other computers.
Single threaded, if a code is interrupted in between, stops there and doesn't allow other part of the code to run.
Java
In this if the same above cases encountered then and tell
Computer to create a Class of English and tell all the students to attend the class(time saving, No complexity and not repetitive)
Same way Creating History class and make all students attend the class at once.
Students may be the objects created.
Multi threaded language, if a task is interrupted following code cannot be stopped. Allows other part of thecode to run.
JVM- Java virtual machine allows Java code into signs that can be understood by computer. Where as C converts into binary code.
A class concept added to C language become C++rant support rant learning to code want to code jvm newbie asking high level languages are cool discussions java c mistakes3 -
So, I have a weird issue. I'm trying to finish my homework and the only thing that's stopping me is that for some reason VS is skipping a line of user input code. Can anyone help me understand why?
cout << "Make: ";
cin.getline((*c).make, 32);
//when debugging the the console skips this line of code. Trying to figure out the issue.
cout << "\n\nModel: ";
cin.getline((*c).model, 32);3 -
My boss is a very smart man, but sometimes he's superstitious as hell. He cannot trust context.list.find() in c# to accept null values, despite that being a thing forever. He's certain that it will break in a future entity framework update, so we have all these duplicate if statements all over our site.
If(blah == null){ //stuff}
Thing thing = context.things.find(blah);
If(thing == null){//stuff}
It kills me a little each time, but I guess he could be worse. I'm glad that he's finally trusting the null conditional operator, because it's a fucking lifesaver for duplicate code!3 -
Why is iOS debugging so fucking useless? Instead of having a normal stack trace which takes you to the line of code that went wrong it just takes you to the bootstrap line in AppDelegate with a random code and basically says "Fuck you, figure it out yourself". Their stack traces are just as useless. IS THIS WHAT SOME PEOPLE CALL THE PREMIERE DEVELOPMENT EXPERIENCE, GODDAMNIT? at least Swift is nice tho, unlike Objective-C4
-
So... I got this “Bitshift Variations in C Minor” code golf to work on a Mac if anyone is interested: http://txti.es/bitshiftvariationsin...
Here is the original, which probably works on Linux: http://txti.es/bitshiftvariationsin... -
I learnt C a while ago and didn’t use it for A semester. One day I needed to write some C code for a small Arduino project and I spent 20 min remembering how to declare an array.3
-
while working with c++(QT) remove inheritance. compile. all good. unrelated code just stops working in runtime. *pouring more coffee*
-
C++ is the building blocks for many high-level programming languages, and since 1984 its first appearance in the markets the C++ core committee developers have introduced its 4 new versions which are C++03 (ISO/IEC 14882:2003 second edition), C++11 (third edition), C++14 (fourth edition) and C++17 is the fifth edition. With each new version, developers introduced new features, libraries and APIs in it.
C++ introduced as the extension of C programming language which made C++ as a compiled programming language, which means the developer required a C++ compiler to translate the C++ code to its equivalent machine or byte language, so the Operating system of the computer can execute the program.
There are various C++ compilers in the market and most of them are open source and free to use, however conventionally when we say C++ compiler, we basically talk about GCC which stands for GNU Compiler Collection.
What is GCC?
GCC stands for GNU Compiler Collection, and it is a collection of programming compilers which induce C, C++, Objective-C, Fortran, and some versions of Java. The first version of GCC introduced in 1987 and it was also known as GNU C compiler which became the standard compiler for C programming language, in that same year GCC also provided Compiler support for the C++ programming language.
Now GCC has various versions and each version give specific support for C++ versions, by now if we look at all the versions of GCC, we have a stable GCC for every version of C++, but there are some exceptions with C++11.
C++11:
C++11 introduced as the 2nd update version of C++, it suffixes 11 because it released in 2011 or because on August 12, 2011, ISO gives official approval to it. Formally C++11 known as C++0X because developers were expecting the new update released in 2010, but with its release in 2011, the core committee developer of C++ changed its name by C++0X to C++11.
C++ 11 replaced the old version of C++03, and it also brings many new features for the C++ developers. The main aim of designing C++11 to stabilize and maintain the backward compatibility of new C++ version with the C+98 and C programming language and that’s become the main reason why core committee developers only introduced new features in the old standard library rather than extending the core language.
GCC does not give Full Support to C++11:
GCC version GCC 4.8.1 purpose the first feature-complete implementation of the C++11 standard, however, the 4.8 and 4.7 does not give the full support for the C++11. The current version of GCC provides the major support for all the standard features of C++11 but if you are using the GCC 4.8 or 4.7 versions then your GCC only provide you with the experimental support for the C++11.
To use the Experimental support of GCC you need to enable it first before you compile or run you C++ 11 version code.
use code std=c++11 or -std=gnu++11 to enable the experimental support for C++11.17 -
When as a php dev you work in an office on projects with .net devs that have to interact and you don't know c/c# and they don't know php so all code snippets shared between you are in python. 🙃1
-
My project setup:
-Entity Framework (Code first)
-Autofac (Dependency Injection)
-Asp.Net MVC C# with service layer pattern.
How is your setup? :)1 -
My life:
Int main(nothing){
while(1){
drink(beer);
code(c);
sleep(the_next_time);
}
return 0;
}
/* compile error -infinite loop found- */ -
That would be lambdas in C++11, nice way to implement callbacks and make them quite generic while keeping code readable :-)
-
Who writes something like this!?!?
if (result == "True")
{
return "True";
}
else
{
return result;
}1 -
Junior Dev: Today I'm porting my (TDD'd) C++ code to C# but having loads of issues.
Me: You should throw away the code, port the tests across and write the code again.
Junior Dev: I think I'll just keep doing what I'm doing.
Me: *triple face plant* -
The fact that Dev C++ editor has SO many preferences kills my will to code sometimes, not going to lie9
-
I had to generate different kinds of graphs at compiletime and had to compile a graph and write down the code size for that specific width/height in addition to one of three implementations which all need to be evaluated. I computer scienced the shit out of it!
I wrote some Rust code that easily lets me build some graphs with the dimensions passed as input parameter. Then i wrote a method that converts the graph into the definition of the graph in a C header (sadly the only way) and wrote a bash script that executes that rust code with all possible dimensions and saves the header into my source folder. Then i build the application and write the programsize into a file.
In the next step i run a python script that reads all the generated files with the sizes and created a csv file which in turn can be used by excel/numbers to visualize the dependency between depth of graph and code size 😄
I had only some hours for it all, it is messy but works 😄 -
Work today as a student: trying to unterstand CERN code - 50 member variables, no local variables - can you please practice some c++??
-
I cant believe threejs requires me to write a c++ code so i can use 3d webgl objects in javascript11
-
First project I'm doing with C++.
I was using Eclipse (for C++ obviously) for some hours. It sucks.
Switched to VS Code. All the editor tool you can dream of are in. But there's no way to configure the project (includes, build system, toolchains…).
"What a fool" I say, remembering there's Visual Studio Community… which is only for Windows.
So I'm currently using BOTH Visual Studio Code and Eclipse.
Why can't there be ONE good, full featured and free C++ IDE for Linux ?38 -
On Windows, which one line input will get this code to print "Finally I get a sticker. Yayyyy!!!" immediately
#include <stdio.h>
int main()
{
char *c = (char*) malloc(sizeof(char) * 10);
int rants = 0;
while(rants<20)
{
printf("U don't want me to get a sticker?\n");
scanf("%s", c);
if(c[0] == 'y')
rants--;
else
rants++;
}
printf("Finally I get a sticker. Yayyyy!!!\n");
} -
When you go through your code and find a couple of lines and you have no idea what they are there for or what they do. They you find out they don't to anything at all and you can't remember why you wrote them. (I think I was trying to test an alternate solution to a problem but then walked away and forgot about it).
Those lines are still there, it bugs me, but I will remember.1 -
Looking back at the VBA code I wrote for work about 10 months ago makes me realize how much reading the Clean Code book by Robert C. Martin did for me, because holy shit my old code is unreadable...2
-
How in the hell did I manage to learn to program in C++ without actually writing the code for past 2 weeks?
I didn't. -
String char replacement in C++ (according to SO):
Boost - replace_all(str1, str2);
C++ STL - 12 lines of code to iterate over the length of the string and store the result in a <char> vector.
Noooooooope. Thank God for Boost.1 -
Best C-Line Ever
#ifndef ULLI_DOESNT_KNOW
#define ULLI_DOESNT_KNOW
#endif
Says soo much about this honest coder :D -
Decided to learn C# after learning C, its a goddamn nightmare I get that C# like C++ wants to abstract and provide supposedly more easier/shorter ways to write Code but honestly I abhor both languages.
Are there any true alternatives that dont focus too much on oop? or arent bloated to hell?4 -
Kind of a followup on my earlier rant, it seems like my "teacher" doesn't even really know C++. He replied to me that "the code doesn't work", which is probably because the code needs the compiler flag for c++11 (I barely even know what I'm talking about here), which he would've known *if he looked at the error message*?!
Have I mentioned enough yet that I STARTED LEARNING C++ LITERALLY ABOUT 2.5 WEEKS AGO?!?! OTL5 -
Ok so slowly learning C also figuring out how to get a few Legacy Opengl code examples to compile. (yeah yeah it's old yada yada) maybe I should try finding unconventional ways to help aid with my learning.
-
<!-- no-rant -->
I want to start testing my code... are there any good resources about testing code? (what piece of the code should I test?) preferably .NET C#4 -
Visual studio! for C++, C#
Notepad++ for javascript
VS because of the many features and automation. Step trough code debugging and organization in one program.
notepad++ for its simplicity -
Currently trying to make newer C++11 code run on a gcc 4.8 compiler. Also making Qt 5 code run on Qt 4.8. Enabling experimental flags on gcc like std=c++1y and turning on flags to turn off complaints about pre c++11 code. Have my cake and eat it too. My favorite so far it to create a proxy object so I can connect lambdas to Qt signals. This is supported in Qt 5, but not Qt 4. I feel like I am traveling back in time to when stuff was shittier standards wise.3
-
std::cout from C++.
Why? Because I use it all the time, can't live without it.
Sometimes the most important pieces of code is the simplest. -
We were learning how to code circles to light up in sequence. As it's similar to how code works for Arduino. Cool. Go back to c# in Unity and teach what the code does not just copy.
-
Could you guys give me advice on how to write good code?
(I'm mostly doing TypeScript and C++)
And what other languages should I learn?14 -
That's it!! Code::Blocks sucks! It can't stay 5 minutes without crashing. Do you guys know a good IDE for C++? (Preferably for linux)9
-
Not a function but X macros in C. Using them makes the code significantly more manageable and cleaner
-
Most painful code!!
Well , it was to write a code in 'C' which will print first N times prime numbers. As a noob , it was really very painful.5 -
i have been interested in robot.and search info about robot.after that i konwn what is program.and started to code with c.
-
Anyone completed Amazon Online Code assessment? How hard is it recently?
I forgot to code in C, forgot data structures and algorithms. Hope 5 days is enough for prep -
I'm currently creating a Qt Wrapper for libpulse by extracting it from an application. The mix of C and C++ code gives me crap and I really want to punch the guy who spread templates all over the place