|
Awia posted:what does Malloc do over malloc? why does it take a type and a random variable and return a pointer? Malloc is a macro that performs a sizeof on the first element and then returns memory of that size. i dont remember what the random variable does and no the macro is not parentheses-wrapped
|
# ? Apr 10, 2016 19:57 |
|
|
# ? May 25, 2024 04:37 |
|
becuase that's so much easier than (int*)malloc(sizeof(int))?
|
# ? Apr 10, 2016 20:01 |
|
BattleMaster posted:lol ugh i'm glad that "programming needs to be hard" is an attitude that has largely died off it's sort of coming back, significantly lowered barriers to entry are the root cause of the whole leftpad debacle
|
# ? Apr 10, 2016 20:08 |
|
The root cause of the leftpad debacle is anyone thinking javascript is a viable language
|
# ? Apr 10, 2016 20:39 |
|
Awia posted:what does Malloc do over malloc? why does it take a type and a random variable and return a pointer? it's probably code:
because they'd didn't want to type out the sizeof or it might be code:
to avoid calloc's zeroing of the returned bytes "for performance"
|
# ? Apr 10, 2016 20:43 |
|
qntm posted:it's sort of coming back, significantly lowered barriers to entry are the root cause of the whole leftpad debacle yeah it's not so much "programming needs to be hard" as "programming well is hard" and significantly lowered barriers to entry result in more lovely programming that was the main problem with BASIC back in the day, then with Visual BASIC, and now with JavaScript about the only decent software I ever used on the Apple II that was written in BASIC were EAMON text adventures, everything decent was written in Pascal or directly in assembly, or cross-compiled in a more exotic way (such as Infocom's text adventures, which were written in a Lisp-based DSL on their PDP-10, and cross-compiled for their virtual machine to run on all the different personal computers) in a way I'm glad Apple never got to release Don Denman's MacBasic, it would have been like when Visual BASIC was released but half a decade earlier, and so many people would have probably turned out lovely software it could have hurt the overall market perception of the Mac
|
# ? Apr 10, 2016 20:52 |
|
qntm posted:it's sort of coming back, significantly lowered barriers to entry are the root cause of the whole leftpad debacle the root cause of leftpad is the overpopularization of a language with no stdlib
|
# ? Apr 10, 2016 21:00 |
|
question: how do i learn to be less terrible? is the only option to somehow apprentice with a legit good code shaman? i am a programmer simply because i'm the only one who raised their hand when we were asked if anyone knows what an ide is. i feel i am missing important information needed to do a good job.
|
# ? Apr 10, 2016 21:11 |
|
HoboMan posted:question: how do i learn to be less terrible? is the only option to somehow apprentice with a legit good code shaman? read a book
|
# ? Apr 10, 2016 21:12 |
|
akadajet posted:If you have a desktop pc just install osx on it. ok so how do i know that all these weird pirate tools aren't going to send my credit card numbers to st petersburg or something?
|
# ? Apr 10, 2016 21:13 |
|
HoboMan posted:question: how do i learn to be less terrible? is the only option to somehow apprentice with a legit good code shaman? spend time in this thread
|
# ? Apr 10, 2016 21:13 |
|
i mean i can just google poo poo, but i am getting the creeping feeling i have some unknown unknowns here.
|
# ? Apr 10, 2016 21:36 |
|
read a book
|
# ? Apr 10, 2016 21:38 |
|
post itt
|
# ? Apr 10, 2016 21:38 |
HoboMan posted:i mean i can just google poo poo, but i am getting the creeping feeling i have some unknown unknowns here. im a poo poo programmer and these books made me improve: http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882 http://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670
|
|
# ? Apr 10, 2016 21:43 |
|
this should help too https://www.se.rit.edu/~tabeec/RIT_441/Resources_files/How%20To%20Write%20Unmaintainable%20Code.pdf
|
# ? Apr 10, 2016 21:52 |
|
Bloody posted:post itt the #1 thing is to getting someone to yell at you when you do/say dumb things
|
# ? Apr 10, 2016 21:52 |
|
code reviews are an excellent way to stop you being a terrible programmer, or at least to be terrible in the way your colleagues expect you to be but i don't think that's an option for you?
|
# ? Apr 10, 2016 21:55 |
|
AWWNAW posted:this should help too https://www.se.rit.edu/~tabeec/RIT_441/Resources_files/How%20To%20Write%20Unmaintainable%20Code.pdf this owns code:
|
# ? Apr 10, 2016 22:24 |
|
that if(0), goddamn
|
# ? Apr 10, 2016 22:45 |
|
HoboMan posted:question: how do i learn to be less terrible? is the only option to somehow apprentice with a legit good code shaman? step 1: write terrible code, watch it cause you pain, figure out why. you will never stop doing this. step 2: listen to people. read books, blogs, talk to coworkers, whatever. be skeptical, but try out their dogmatic ideas. some of them have some wisdom. many more will cause you pain. (protip: try out new things where it will cause you minimal pain.) step 3: eventually you will start having your own dogmatic ideas. be skeptical of them, too. your dogmas aren't any better than anyone else's. but it isn't always worse, either. after all, no one's doing exactly what you're doing but you. basically fail a lot, think hard about why, and apply that thinking to other people's failures and successes. programming is still a craft, and you only improve at a craft by messy practice, by carefully trying out the techniques of others, knowing that they may not work for you, even if they work in other environments. programming is communication, mostly with other people (including future you), and secondarily with computers. get out there and talk to people, and secondarily computers.
|
# ? Apr 10, 2016 22:52 |
|
Awia posted:read a book books r 4 nerds nd i neve read a book in my life and it got me very far PokeJoe posted:im a poo poo programmer and these books made me improve: i bought that second one once for a class but they didn't use it for giving assignments so i returnded it without even looking at it, lol
|
# ? Apr 10, 2016 23:04 |
|
AWWNAW posted:this should help too https://www.se.rit.edu/~tabeec/RIT_441/Resources_files/How%20To%20Write%20Unmaintainable%20Code.pdf i couldn't breathe by the end of the LISP paragraph
|
# ? Apr 10, 2016 23:30 |
|
AWWNAW posted:this should help too https://www.se.rit.edu/~tabeec/RIT_441/Resources_files/How%20To%20Write%20Unmaintainable%20Code.pdf yessss i've been looking for this
|
# ? Apr 10, 2016 23:57 |
|
PokeJoe posted:im a poo poo programmer and these books made me improve: clean code by and code complete 2 ftw
|
# ? Apr 11, 2016 00:52 |
|
i'm a 10x programmer every code review gets kicked back to me 10 times
|
# ? Apr 11, 2016 00:53 |
|
code complete 2 is good if you have 300 uninterrupted hours at work to do literally nothing but read it and maybe try a few examples (like if you got put on "special projects" for 6 months) It's very dogmatic and you should only follow what might work in your situation. It helped me think about programming differently early in my career.
|
# ? Apr 11, 2016 01:52 |
|
i looked up the macro for you nerdscode:
|
# ? Apr 11, 2016 01:56 |
|
Notorious QIG posted:i looked up the macro for you nerds you don't need the type cast
|
# ? Apr 11, 2016 02:45 |
|
qntm posted:it's sort of coming back, significantly lowered barriers to entry are the root cause of the whole leftpad debacle it never really went away, it just never stopped or influenced the people trying to make programming more accessible it's ok i have come to understand that people will write the most unapproachable horrors in whatever language they are given so i feel the argument is moot: we can make programming languages more accessible and the ones opposed can continue to make their projects garbage for for coworkers. also root causes are for children's stories - javascript doesn't have a mature standard library - even if it did people have to distribute polyfills because of the way of browsers - people have patched over it and punt on it to npm - npm allows people to unpublish work, - people included these polyfils but did not vendor them - someone unpublished a module which people depended on and broke builds - people rely on third party tools written by volunteers and would rather complain on hacker news than fix things - no-one has any good opinions on what to do or change b/c it's easier to argue about how trivial a module was rather than the wider ramifications of builds not being repeatable or deterministic (toot)
|
# ? Apr 11, 2016 02:56 |
|
HoboMan posted:question: how do i learn to be less terrible? is the only option to somehow apprentice with a legit good code shaman? - practice - make less of the mistakes you know - make new mistakes and learn from them really being a good programmer is not about doing the right thing but knowing lots of bad things and avoiding them good ideas tend to be unique to a project but the bad ideas are everywhere quote:i am a programmer simply because i'm the only one who raised their hand when we were asked if anyone knows what an ide is. i feel i am missing important information needed to do a good job. honestly the most important poo poo is nepotism and company politics, after that coding mostly becomes - code that won't wake you up at night - code that won't gently caress over your customers - code that doesn't leak secrets it is meant to keep - code that doesn't get in the way when you change your mind but most of what you do in coding depends if you make money for the company or are a cost of money
|
# ? Apr 11, 2016 03:02 |
|
HoboMan posted:i mean i can just google poo poo, but i am getting the creeping feeling i have some unknown unknowns here. imagine a blinking gif that says "just code" be interested enough in programming that you sometimes read a book or watch a video learn from you mistakes. have facepalm moments when looking at code. make something for yourself, even if it's some dumb thing like a greasemonkey script that alerts you when a thread on sa is ripe for snypin'.
|
# ? Apr 11, 2016 06:24 |
|
#justprogrammerthings
|
# ? Apr 11, 2016 06:39 |
|
HoboMan posted:i mean i can just google poo poo, but i am getting the creeping feeling i have some unknown unknowns here. It's like lots of other disciplines. You need to do it a lot, review your old stuff honestly, and work to try your hand at different aspects of it in order to gain a real understanding. You only get better through failure and reflection. If you're not failing then you're probably not learning very much, and it's probably better for you to fail more often in your own personal projects than with work projects. So work your way up from small hobby projects, and keep at it. Eventually you might become a not terrible programmer. all programmers are terrible because programming is terrible
|
# ? Apr 11, 2016 07:41 |
|
remember that programming is a discipline and that you should write some loving tests, where are your goddamn tests man
|
# ? Apr 11, 2016 08:46 |
|
Awia posted:becuase that's so much easier than (int*)malloc(sizeof(int))? you don't need to cast void *, unless you forgot to #include <stdlib.h> and malloc is implicitly declared as returning int (which is fun fun fun when int is smaller than void *)
|
# ? Apr 11, 2016 09:07 |
|
ahmeni posted:remember that programming is a discipline and that you should write some loving tests, where are your goddamn tests man or at least acknowledge you should write tests then sigh wistfully and get back to implementing new features without fixing old bugs
|
# ? Apr 11, 2016 14:48 |
|
hackbunny posted:you don't need to cast void *, unless you forgot to #include <stdlib.h> and malloc is implicitly declared as returning int (which is fun fun fun when int is smaller than void *) whoa, what? is that standard behaviour or some weird rear end compiler-specific thing? either way it does sound like a ton of fun indeed
|
# ? Apr 11, 2016 15:35 |
|
YeOldeButchere posted:whoa, what? is that standard behaviour or some weird rear end compiler-specific thing? if you use an undeclared function, it's implicitly declared to return int, in c89 at least, i think as of c99 it's just an error
|
# ? Apr 11, 2016 15:58 |
|
|
# ? May 25, 2024 04:37 |
|
YeOldeButchere posted:whoa, what? is that standard behaviour or some weird rear end compiler-specific thing? standard C behavior. if a function isn't declared, it's declared on first use as taking a variable number of arguments and returning int. I wonder if they finally deprecated it. other things you probably didn't know: C++ code:
|
# ? Apr 11, 2016 16:02 |