Live data from Hacker News

Poll: Do you know C?

news.ycombinator.com

131–140 of 208 posts

Re: Poll: Do you know C?

#131
post #65
post #55

Earlier quoted context omitted.

You don't know C. Coding in C and C++ has diverged significantly enough that they are two completely different languages. That said, answer #3 or #4 makes sense.

I said I would consider it a burden to write in pure C, not that I would not be able to do it. I would not need any documentation, but I would scratch my head figuring out how to organize a large program. I would need to write a lot of comments to replace things that do not exist in the language: const-correctness, memory management conventions, type-safe containers, etc.

"How to organize a large program" is a large part of what learning to program in a language means.

BTW, const correctness is in C99, and memory management is usually done by writing constructors and destructors like C++ (except that they're real functions, often named stuff like _init and _destroy or _new and _free) and calling them manually. It's not as elegant as RAII, but if you write short functions with clear logic, you can usually ensure you cover all code paths. Remember that you don't have exceptions to screw up control flow in C.

For type-safe containers, I just use void* containers with a comment indicating the intended type, but perhaps more experienced C programmers have a better system. Remember that Java didn't have type-safe containers until Java5, and honestly ClassCastException was a fairly rare error.

Re: Poll: Do you know C?

#132

Earlier quoted context omitted.

I'm 25 and consider myself very well-versed in C (though I still have to consult the C99 spec from time to time). When I was learning to program modern computers around the turn of the century, it was the only "serious" language for writing desktop apps (I had recently "graduated" from VB4). I then refined my skills over the course of my electrical & computer engineering degree and a short stint in the EE industry, w…

FPGA designer here. I don't think it's accurate to claim that SystemC is replacing VHDL and Verilog for ASIC/FPGA design. I view SystemC as a niche tool to allow software engineers to dabble in hardware design. I use C for embedded software, but would never dream of designing hardware in anything else except pure HDL. It's a bit like trying to write a letter in a foreign language using Google Translate-- the results…

While trying to learn HDL I felt like Verliog was more naturaly than VHDL. I didn't bother trying to learn SystemC or anything, organizing a project on Quartus or ISE is hard enough as it is with Verilog.

I need to go back to dabbling with my little Spartan3E board though.

Re: Poll: Do you know C?

#133
I've been programming in C for years.

Unfortunately, those years were mostly in the 80's and I've barely touched it since, so I really have no idea if I can still call myself a C-programmer. I used to be good at it though. At least that's how I remember it...

Re: Poll: Do you know C?

#134
post #130

I wish more languages had books equivalent to K&R. Here's how I learned C. 1. Buy K&R. 2. Read it. Maybe 2 or 3 times during the process of reading it, I would go write a program to try what I had just learned. This was was around 1980, so trying a program meant walking across campus to a terminal. I could either head to the computing center and use a public terminal, or to the high energy physics building (where I h…

Exactly what I did, fifteen years later. I haven't programmed for anything but fun in ten years, but sometimes fun means C or dialects. It has a staying power in my mind that I attribute to the rigor both of the language and of K&R.

By contrast, I did Perl work for years, and went to script something in it recently. Quickly decided it would be easier to learn Python from scratch than to get my Perl chops back.

Re: Poll: Do you know C?

#136
I'm about to get out of college, and at my new job I'm using mostly C. Well-written C is surprisingly fun to work with (although you could probably say that about anything).

Re: Poll: Do you know C?

#138
post #130

I wish more languages had books equivalent to K&R. Here's how I learned C. 1. Buy K&R. 2. Read it. Maybe 2 or 3 times during the process of reading it, I would go write a program to try what I had just learned. This was was around 1980, so trying a program meant walking across campus to a terminal. I could either head to the computing center and use a public terminal, or to the high energy physics building (where I h…

I program primarily in C and believe I know all there is to know about it. But I have never read K&R. A few weeks back, I started reading it, got bored and gave up. But I keep running into people who swear by K&R. Do you guys think it is worth a read after the fact?

Re: Poll: Do you know C?

#139
post #78

Earlier quoted context omitted.

He's manager doesn't get to program all day though :P As long as it's a company in which compensation isn't determined arbitrarily by position in hierarchy it's a great thing.

Amen, brother. Like being a contractor with a high rate who gets to program all day and ignore the political bullshit.

As someone who has been a "contractor who ignores all the political bullshit", my personal observation is that it is the contractors who are actually good at navigating the political bullshit (win friends and influence people and all that jazz) tend to be the ones who get top dollar and have continuous employment. Whereas the contractors who are merely extraordinarily good at programming tend to have a lot of downtime in between short engagements.

Some people think that if you have social skills you can't be a 'real' hacker, but often sales skills and good presentation are a force multiplier for a contractor with good technical skills.

Re: Poll: Do you know C?

#140

Earlier quoted context omitted.

Reminds me of some C-code I was told to port to Linux (if I remember correctly) some years back (probably in 2003). The code was from 1981 (it said so in the comment header). Except for the fact the code was almost as old as I am (born in 1976) it turned out that the security check that the code was supposed to perform didn't actually execute. Yepp, that's right, the code had been running for 30+ years doing nothing.…

This reminds me of an interesting event that occurred in my C++ class. During one of the assignments I looked at a peers code. I became convinced that the code was wrong. His code looked a little like this: bool operator He ran the code and it worked. I was confused. Another student saw the teacher pass him and copied his implementation. His code didn't work. It gave the stack overflow error that I was expecting. It…

I was teaching one of my good friend C way back in undergrad(1999). After explaining him about loops among other stuff...i asked him to print something in loop. And this is what he wrote

For(i=1 to 10) {then print i; } Today my friend is working as a techie ....senior mgr at his new company!

Post reply on HN