Ranter
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
Comments
-
Bubbles66126y@Stuxnet I need to Learn C and get good grades and move on with my life but I just cant do that
-
@Bubbles I stopped majoring in CS because of prerequisites being unnecessarily difficult.
I'm not going to ruin my life over a degree that will likely not help me because I'm going to be a shit programmer lol -
Bubbles66126y@Stuxnet I want to learn C, I've wanted to for a long time now and I still have a few other languages to learn on the back burner but I'm waiting til I'm comfortable with my C and JavaScript
-
@Bubbles not to ruin your hope but fun fact: C, while it is one of my favorite languages, will never be fun. It stresses me out every time.
There's no objects, keeping track of which pointers are on the heap, and did I memset it, is that memory even mine? did I free it? Make sure not to double free, that would be bad. Need user input? Good luck with that! Use scanf they say, it's perfectly safe they say. Gcc's stack canaries and ASLR are perfectly adequate they say.
Sorry man. C is a nightmare. A fundamentally important and semi enjoyable, bug filled nightmare. But hey, YMMV. -
Bubbles66126y@deadPix3l I'm learning C for many reasons but the problem was actually learning i/o 😂 but everyone was telling me in the most complicated ways why my code wasnt working properly and were too busy telling me to never use this or that and use this and I dont even know how and it's not like they fucking explained it. Idk I just need to get good with it to have a basic understanding of how the language works, cause if I have that itll be a lot smoother of a process reguardless of the problems. But idk what all that encompasses as well. FUCK
-
Bubbles66126yJavaScript is the same way I've gotten the basic understanding and now I'm moving on to the more in depth stuff
-
@Bubbles the short answer is:
If you are doing homework or simple, non critical tasks running as nonpriveledged users: scanf is fine.
Otherwise, for security sake never EVER use scanf. There's many approaches, none of them well documented, but I usually stick with one of:
A) get an I/O library. They are smarter than you.
B) a complex 80 line function similar to scanf based on getc which constantly does bounds checking, clears memory, reallocs as needed, avoids format strings, and a bunch of other things. It's still probably unsafe. -
@Bubbles I'm pretty sure there are. There's gotta be. None that I can think of though.
K&R recommend using snprintf to create the format strings for scanf apparently, or gcc allows the "%as" specifier to dynamically allocate the memory. I've never heard of either of these but they may be worth a look. -
There's some hitting your head to a wall required with I/O in C, but it's not like you can't find the better practices anywhere.
-
Scipio6926yCS classes were never the problem for me, although I am in the early stages and my experience makes the classes much too basic.
It’s all the math and other general education that gets to me. Would rather take 4-5 CS classes than 1 CS class and 5 general education classes. -
rant1ng44626ychill
all you have to do is work at it
day by day
one day it'll all come together
only so much you can do at any given moment, -
Dude I’m right there with you. I made a 67 on my C++ midterm for data structures and algorithms. Fuck induction and fuck mathematical complexity analysis.
-
@Stuxnet nonsense! I am pretty sure you could have breezed through that mfker if you wanted to.
-
Look brochacho. Computer Science is meant to be hard. I really believe its a unique and awesome field because you are supposed to know a bit about everything. Physics, Biology, Math and a fuckload of other scientific topics. Why? Because we are supposed to be able to implement software that solves things for a wiiiide array of problems, from the mundane(creating a form for users to talk about dick) to the glorious(fucking quantum computations on shit that defies awesomeness, musical notation programs, dna sequencing illustration s or crash simulation and analysis programs)
To top it off, you need to be good with the tools i.e computers and software development.
Ye, its frustrating, ye its time consuming. But at the end of the day you would have demonstrated that you had the pinches huevotes(bigass balls) to fucking beast mode through that bad boy and got yer degree.
Practice, read, even if you don't get errthing, you'll get there.
Just don't stop studying and don't stop being curious -
C is fun and easy, a nice compact language. OO idioms? Easily possible in C. I/O? Come on, use fgets(), it's not hard.
You can even bypass the standard library, use read() and write() directly and buffer as you see fit. Also, it's faster where you pipe a lot of data in/out.
Dynamic memory allocation? Don't use that for every little shit you're doing because the allocator will be fast most of the time except when it's not, same problem as for GCs. -
Yeah im currently working on a college project with C as well. Trying to get the communication between python and C to work. But holybbqs this is hard if you have done C for about 2 weeks. Finally got a semistable receiving of commands and sending responses, but then comes the simple get and set functions for some variables that seem to work, but just dont seem to work.
-
OPM465716yI always hate collage. That's why I never look back when I graduated. Neither to those books.
-
Bubbles66126y@OPM46 2 of the classes right now I dont need bc at the time I planned them it was when I wanted to go to this big school but 3 weeks later I changed to a smaller school but I have to still take those classes. And the amount of work the teacher gives us in math is so uncalled for and stressful
-
Bubbles66126y@Fast-Nop I was told that but not told how to use it, and I wanna atleast get the othe basic methods to work :/
-
Bubbles66126y@electrineer it doesnt help when people wont help me understand what my problems are
-
I am actually working on the project now and am encountering an issue in the serial communication where the first command works fine, but the second one isn't handled properly :(
-
Well our project is to have a shutter programmed in C and an external Python program that can control it. We work using commands, so in python I send "SCREEN OPEN" on which C responds "STATE OPENING" for example. But if I send "SCREEN CLOSE" (or even the same command for that matter) the C side doesnt seem to handle the command at all :(
-
mundo0349116y@Bubbles as far as I know, that is how people teach C, they never actually know what is up and just give the "don't do that" with out understanding it.
So .. get books -
@AleCx04 I probably could have passed but it's not gonna help me out enough if I'm still a shit coder lol
-
mundo0349116y@Bubbles have not find any, i was using learn-c.org but I am just starting, it's pretty basic
-
@Bubbles using fgets() is easy. From there on, you can continue via sscanf() or e.g. strtok() for tokenising.
Or did you mean OO in C? The key is structs with function pointers.
You can even have some sort of templates and function overloading if you code the algorithm in a parametrised macro that receives the data type. Then you "instantiate" that macro in a data type specific function and hide that away by using generics. -
Bubbles66126y@Fast-Nop I'm in the very basics over here lmao but I've been hearing about fgets qnd the others what's so bad about using getchar() gets() and puts()?
-
@Bubbles hey, Im relatively rusty but I can help answer questions and reinforce things if you'd like. Also I have a ton of books somewhere (may take me a day or two to find). But you can PM me (preferably email until we figure something else out) if you'd like.
-
@Bubbles getchar() requires a return after the character unless you use non-portable terminal configuration stuff, otherwise it's fine. puts() is OK for displaying constant strings, just remember that it appends a line break.
gets() is a security hole because unlike fgets(), it doesn't have a parameter how long the string buffer is. The result is buffer overflows with long input lines. Remember also that arrays in C do have length information, but as soon as you pass them to a function, they become pointers and lose the buffer length info. That's the reason for the typical C idiom where you always pass in a pointer and some sort of length (byte size, element count or so). -
Bubbles66126y@Fast-Nop a lot of this is new terminology considering I mostly use Python and JS 😅 but I think I understand what you're saying. Thank you
Related Rants
-
xjose97x19Just saw a variable in C named like this: long time_ago; //in a galaxy far away I laughed no stop.
-
nikmanG16CS Professor: “What M word is the black hole to all productivity?” Student: “Management” CS Professo...
-
elgringo41Student - Teacher renaming .c to .exe make the program executable ? Teacher - Yes A group of people stand up...
Fuck College, Fuck C, Fuck the people that didnt help me with my C code and in fact made my problems worse and didn't fucking help me, Fuck the bastard that decided to give my the largest mountain of homework, fuck my inability to get shit done, fuck myself for not getting motivated to do anything. And also fuck Javascript cause its JavaScript.
Edit: IM ALSO FUCKING RETARDED
rant
javascript
c
i'm an idiot
college
fuck this shit
fuck me
fuck college