Live data from Hacker News

To become a good C programmer (2011)

fabiensanglard.net

91–100 of 106 posts

Re: To become a good C programmer (2011)

#91

The more I learn C the more I hate it. At first it seems simple and easy but reading "Expert C Programming" is reading a laundry list of what's really messed up with the language. 80% of the problems would be solved by some sane syntactic sugar that compiles down to C

You might like Go....I find it's 90% of the good-ness of C with only like 10% of that badness

Re: To become a good C programmer (2011)

#92

I'm interested in learning about reverse engineering and malware analysis. Is learning C the proper first step in getting my hands dirty? I used C++ in a few college courses, but I've been primarily a Java developer for the past two years.

Definitely C, and you will also need to know a fair bit of assembly. Also familiar yourself with the PE (portable executable) format and learn how to use IDA disassembler and possibly SoftICE (Not sure if it still works, but it was/is a very powerful kernel debugger)

Re: To become a good C programmer (2011)

#93
post #74

Earlier quoted context omitted.

I hope you don't have a stroke: https://github.com/jsoftware/jsource/blob/master/jsrc/cip.c ...just one of the many source files that make the interpreter for the J language.

The 'style' even leaked out to file naming: a.c, ab.c, af.c, am.c, c.c, ca.c, cc.c, cd.c, cf.c, ... Brilliant! I doubt that this is either serious (unobfuscated) or handwritten code though.

No, it really is the hand-written source code for the J language (http://jsoftware.com/) interpreter. You may also enjoy:

https://news.ycombinator.com/item?id=2336749

http://code.jsoftware.com/wiki/Essays/Incunabulum

Re: To become a good C programmer (2011)

#94
post #90
post #85

Earlier quoted context omitted.

Let us see... in my day, we called an "asm code generator" an assembler... anyone remember MasterSEKA, Devpac, TRASH'M-One and ASM-one?

1. Program that reads some input (e.g., C language) and generates asm and/or opcodes. 2. Program that reads asm and/or opcodes and generates binary numbers ("object files"). No. 1 is what I need. No. 2 is what I call an "assembler". Although terminology means less to me than what a program actually does.

No. 1 is literally the exact definition of a "compiler". I still don't understand the distinction you're making.

Re: To become a good C programmer (2011)

#95
post #24

The more I learn C the more I hate it. At first it seems simple and easy but reading "Expert C Programming" is reading a laundry list of what's really messed up with the language. 80% of the problems would be solved by some sane syntactic sugar that compiles down to C

I would say generally I feel that way about any language I've learned. Initially they are pretty easy and the examples given include slick solutions to contrived problems. Then you get into wanting to do real work and you learn about all the corner cases and ambiguities and landmines that are hidden farther afield. Can anyone name a language that they've grown to like more the more they learned about it? I would gues…

> Can anyone name a language that they've grown to like more the more they learned about it? I would guess maybe only those in the LISP family would make the cut.

You're correct that a few of the Lisps have had this effect for me (Scheme, Common Lisp, EuLisp, Le-Lisp, elisp), but there have been a few dialects that I came to like less and less as I learned them (note that I do not necessarily dislike them, rather I'm disappointed by them): Clojure, Newlisp, and Racket, for example.

There are a few non-Lisps that I find myself liking more and more as I use them: Kitten and Mantra. They're both concatenative languages that take somewhat different approaches from the usual Forth-likes. I'm still not super proficient with them, though, so it's possible that the derivative of my fondness for them will invert yet. I've also had that experience with ksh (believe it or not) and Vim (a DSL for editing, if you will).

There have also been a few languages that have had a sort of "roller coaster" effect: at first they excited me greatly, then as I learned them better and better, I liked them more, then less, then more…. Some examples that come to mind are C#, Datalog, Haskell, Modula-3, OCaml, Prolog, Rust, and Standard ML.

Re: To become a good C programmer (2011)

#96
post #24

The more I learn C the more I hate it. At first it seems simple and easy but reading "Expert C Programming" is reading a laundry list of what's really messed up with the language. 80% of the problems would be solved by some sane syntactic sugar that compiles down to C

I would say generally I feel that way about any language I've learned. Initially they are pretty easy and the examples given include slick solutions to contrived problems. Then you get into wanting to do real work and you learn about all the corner cases and ambiguities and landmines that are hidden farther afield. Can anyone name a language that they've grown to like more the more they learned about it? I would gues…

> Can anyone name a language that they've grown to like more the more they learned about it? I would guess maybe only those in the LISP family would make the cut.

Well, personally I've fallen in love with using FORTH for when I'm doing my hardware hacking (mostly on Arduino). I don't think that anybody would call it 'in the LISP family', but the language has similar grammar-extension capabilities, and I adore it for that.

Re: To become a good C programmer (2011)

#97
the biggest virtue of a c-programmer is temporary forgetfulness.

forget for the moment, that all of the old-guard-tech foundations is basically a castle made of glued together jello filled rubber ducky's. forget all the tricks needed to jump through that final hoop in assembly. forget even those hopeful endeavors of the languagewiser that stood up, and then came back because performance is a bitch and there use cases to edgy. forget all those library's that overpRomised, undereallocated and disspointered. forget all the futile attempts to steer this boat, carried on the hands of the likes of you, towards some sail-able waters. blissful unawareness settles in, while every "good c-programmer" near you starts to spit fire as soon as management declares a new megalomaniac project in C worthy the effort and thus starting. forget that strange feeling of elated Shame of being the best to repair the most broken car in town.

Then, and only then, you will be a "good" C-Programmer, one that knows all the tricks of trade, while not getting wiser.

Re: To become a good C programmer (2011)

#98
post #24

The more I learn C the more I hate it. At first it seems simple and easy but reading "Expert C Programming" is reading a laundry list of what's really messed up with the language. 80% of the problems would be solved by some sane syntactic sugar that compiles down to C

I would say generally I feel that way about any language I've learned. Initially they are pretty easy and the examples given include slick solutions to contrived problems. Then you get into wanting to do real work and you learn about all the corner cases and ambiguities and landmines that are hidden farther afield. Can anyone name a language that they've grown to like more the more they learned about it? I would gues…

> Can anyone name a language that they've grown to like more the more they learned about it?

Haskell

Re: To become a good C programmer (2011)

#99
post #63
post #19

What's a good practical but small enough project you can do with C? Typically if you are learning Ruby or Node, people recommend creating a blog. What's something like that for C?

I made a small database software engine. Learned a lot about pointers and C syntax, and I still use the software sometimes. SQLite is written in C, if you didn't know.

That's a really cool idea. Thanks.

Re: To become a good C programmer (2011)

#100
post #90

Earlier quoted context omitted.

1. Program that reads some input (e.g., C language) and generates asm and/or opcodes. 2. Program that reads asm and/or opcodes and generates binary numbers ("object files"). No. 1 is what I need. No. 2 is what I call an "assembler". Although terminology means less to me than what a program actually does.

No. 1 is literally the exact definition of a "compiler". I still don't understand the distinction you're making.

That's because it is a compiler.

No. 1 is a program that accepts input (e.g., RTL, MINIMAL, etc.) and generates asm.

I like to call this an asm code generator. Because today when people say "compiler" they are often referring to a collection of programs, some of which do not generate asm.

Post reply on HN