- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I definitely agree that you can get C code that will compile as C++ but will not run. But I still maintain that generally, decent C code can be compiled as C++ with little to no modifications because often, the bits that break in C++ can be done better in C anyway.
Admin
No it's not.
No implicit void* conversions C99 allows dynamic arrays on the stack, C++ does not Valid variables names in C code are reserved words in C++
etc...
Admin
"United Stated"?
Also, C/C++ nerds STFU and go get a room already.
Admin
Computer hardware is cheap, programmers' time is valuable. If something can be produced in a fraction of the time in a managed language, with fewer bugs, it is a net win. See Rico Mariani's Performance Tidbits. It took 5 versions of unmanaged optimizations (and one bug fix) to equal the speed performance of the first managed version. Only after the 6th (and final) unmanaged optimization did the unmanaged version get faster. And one might question whether a drop from 0.093 seconds (optimized managed version) to 0.062 seconds (optimized unmanaged version) for this particular task provides any value.
The real cost of the managed version is revealed here:
The entire series is available here.
Obviously you can not conclude too much from the result of just this one benchmark, since it would be trivial to provide examples where managed languages are slower, but it does demonstrate, in a thoughtful and detailed way, that even a poorly coded managed application can compete with an optimized unmanaged application in terms of speed, even taking into account the startup overhead of the managed environment.
Admin
Generally (although I admit not always) if a C programmer is writing good C it will just work in C++. For the malloc example above the C Programming Language (2nd ed, I can't find my first edition to see if it has changed), says that you should explicitly cast malloc. If you do that then the code becomes valid C++ code also.
Admin
I wouldn't bring C99 into it. You do realise that breaks half of the "things that work in C but not C++" bits.
Admin
When I recruit, if I'm getting 10+ CVs a day I'm binning anything that isn't very well presented to cut down the time I spend reading them. It's the easiest field narrower, if you can't get one simple short document about content you know intimately correct and readable and figure out how to use a spelling and grammar check then I don't need you. That does happen after HR or whichever geek pimp we're paying too much have filtered out those without the right skills though so I don't end up interviewing Word jockeys.
Admin
In other words, use the right tool for the right job ^_~
The first false assumption is 'hardware is cheap, programmers are expensive'. This is often (possibly usually) the case, but not always. Number crunching (scientific software, economic analysis, MRIs, etc) time is money and every millisecond you can squeeze out translates to big gains.
I can recall spending 9 months taking a single task from 20ms to 1ms per iteration. That was my task for those 9 months and getting that time down saved WAY more money then my salary. In fact, every millisecond shaved off equaled more then my salary for the year.. so even going from 20ms to 19ms would have been worth 12 months of my time to the beancounters.
Admin
That's pretty cool :-)
I've just had to go and rewrite some code that was working on the hardware is cheap mentality. Unfortunately hardware doesn't scale up as fast as the "algorithms" used in the code.
Admin
{sigh}
- http://public.research.att.com/~bs/bs_faq.html#C-is-subsetNow shut up, the both of yous.
Admin
+1
Thanks.
Admin
Obviously the way to make your CV stand out is to put your name in WordArt on every page.
Admin
hu? you can't be serious. 1% maybe. Let's say 10% to have some margin. Not the half.
I've read sooner that your reference is "The C programming language" 2nd edition. Despite all the respect I have for its authors, C has evolved. You should consider reading seriously the ISO C99 standard (and not an informal book, which is just OK to begin but always has serious pitfalls for careful and serious programming). You would learn that C++ is not at all a superset of C anymore, even when not considering obvious superficial differences like void *, enums, and variable-length arrays.
Admin
Nah, Knuth gave us char*, which is almost always size 1.
Admin
I have read the C99 standard. Which is why in my previous posts I asked whether posters where talking about K&R C, ANSI C or C99... because they are all different. ANSI C is most likely to compile as C++ and C++ written in a C style is most likely to compile in C99.
And yes I exaggerated about C99 breaking half the things but most people's claim the C has all these differences to C++ is incorrect. If you write that sort of C code it will probably break if you use a C99 compiler.
Admin
Almost never :-), sizeof(char) perhaps?
Admin
Ugh. That old faq. yeah, real great perspective there. It makes me wonder how much C this person really programmed in vs 'I could do this better!'. Claiming he needed to develop a whole new language to get generic programming, OOP, and data abstraction really makes me wonder how he was using C since it has all of those things. C++ makes these things easier (most of the time) and safer (pretty much all of the time) but it does not add any actual new expressive power.
And of course all the "C is never better then C++ under any circumstances" are just dripping with lack of perspective. To this day C++ does not have the flexibility (without lots of extra code) of C in things like polymorphism. Runtime modification of classes in C++ has always been a pain unless you add wrapper syntax at which point you are back to the C method but with more code (and symbol table clutter).
Admin
That's two seconds more than the first screen has....
End of the day, I don't really think pretty little flowers in the borders makes much difference - but if it doesn't make a difference, why not do it just in case it does?
Admin
Shouldn't that be " its' "?
Admin
Makes good sense for HR because it reduces their workload....
Wouldn't it make more sense to read thoroughly through resumes as they arrive. You don't need to get through all of them, only until you find one (or a few) that you like.
Does this get the best candidate? Not necessarily. Does this have a better chance of getting a good candidate than judging whose puppies are the cutest? Probably.
Of course thios advantages people who get their resumes in reasonably early (although you could randomly read ones until you find one - if you could mix them up sufficiently well to be random).
Someone once told me the key to getting a DoD job was to apply every month - even if they weren't advertising. Every resume would go into a big bucket, and when they decided they needed someone, they would start looking at resumes until they found one. The trick was to make sure you had one sufficiently near the top.
I must say, part of me agrees that it's difficult for people to sort through 1000s of resumes for several positions, but the other part wonders why is there a HR industry? Companies have developed HR departments, and gradually HR Specific Companies have developed. I have always thought HR departments were largely unnecessary - and this type of attitude of randomly (or at least pseudo-randomly) picking the best candidate seems to confirm that HR departments are unnecessary. Every time a company does lay-offs, who are the first to go? HR, Admin and middle management. Why? Because they are the least useful parts of a company (well Senior Management might be largely useless too, but they're hardly gonna cut their own throats!!). (IT) Companies need Technical people, and low-level managers to manage them (their cheaper than more senior managers - and probably more technical). HR, middle-management etc. on the other hand is an expensive luxury not a necessity (particularly when people are recruited at random)......
But...I go now....
Admin
by definition, sizeof(char) == 1, always! Even if your char happens to use 32 bits!
Admin
I suspect this is the point our Anonymous friend (and indeed many others, by the look) was making. HR departments are useless. HR departments do all the recruiting for most companiesm, irrespective of role (janitor, secretary, Manager, someone who actually works etc). HR departments are (often) lazy, and (often) do not understand the skillsets required for many roles.
Sure, it's frightening that this is how people recruit, but sadly, I suspect a colour printer pretty pictures of things like hot air balloons probably raises your chance of getting a job at many companies.
Admin
If ya wanna be my coder Gotta get with my friends ANSI C is easy Friendship never ends
Admin
NO! In ANSI/ISO C, you don't need cast the return from malloc. There are reasons why this practice is bad.
Try putting "casting from malloc" into a search engine to find out more.
Admin
But this assumes that Good Candidates, Adequate Candidates and Crap Candidates are equally as likely to add bells and whistles to their resume. I suspect that generally (other than those who know how recruiters work) the better candidates will asume their work and study histories speak for themselves, and there is no need to decorate the page. It is important to make sure the resume looks tidy (don't change font every paragraph, make sure things don't hang over pages funny, etc). Adding all sorts of pictures and patterns to me implies that there is nothing in your resume' of interest, so you added interesting patterns.
Of course, I understand that those responsible for recruitment think otherwise.
Admin
Thankfully I am immune to charm....
Admin
There are also reasons why this practice is good:
double * x; x = malloc(sizeof(float)10); / Geez whoops */
Admin
Good God Man!!! How can a one page resume even begin to outline what a good candidate has done in their career. I agree resume shouldn't be too long, but one page is a bit short, isn't it? If it were well formatted it would ONLY fit the points you specify (if you've only studied one degree, and have only worked in 2 or 3 different jobs). That's a bit of a problem, seeing as one of those points wasn't Contact Details.
I find it strange that someone who (presumably) works in IT would shrug off a 66% time increase in reading (ie taking five secs instead of 3). Over 100 Resumes, this makes more than 3 minute difference. Over 1000 Resumes this makes more than 33 minutes difference.
Admin
That's why they like the triangles behind the text - they're trying to test how good their OCR technology is with Captcha style documents
Admin
How about the more relaxed dolphins? Is C++ not a superset of C for them?
Admin
So...you assume HR will know what skills you want, and then you filter on presentation? Sounds a little backward to me.
Spelling, Grammar and Presentation are reasonable criteria to pick resumes over, but I think the point in the WTF is OTT decorations, not proffessional presentation.
Admin
Correct.
Admin
This, however, is a trivial C program, and as such I have submitted it to a trivial C++ compiler -- MinGW's g++. Yes, there's an error:
"trivial.cpp: In function
int main(int, char**)': trivial.cpp:19: error: invalid conversion from
void*' to `S*'"Refining to (struct S*)malloc(...) removes the error. The behaviour will be the same in C/C++.
Are you seriously telling us that you don't understand what a straw-man argument is?
Bah. I'm much more concerned by the fact that somebody as obviously smart as Dan M can scribble all over his resume with things like:
"Languages and technical writing: PHP, MySQL, AJAX, JavaScript, PRADO Framework, MSSQL Server, C#, .Net Framework, Perl, C/C++, Visual Basic, ASP, HTML, DHTML, XML, SOAP, CSS, Java, UML"
... and not immediately think:
(1) Laundry list (2) Laundry list full of smelly socks
Under the circumstances, it's perfectly reasonable to expect the candidate to be amenable to a Web programming position involving C/C++. It's not as if there aren't a number of C/C++ web sites around -- I've worked on a few. I don't recommend it as a design/architecture decision these days, unless you're looking for a ridiculous amount of performance on a nightmare maintenance system -- but it works. Just look at FCGI for starters. Then, consider: what's the difference between a huge organisation builiding its own, appalling and idiotic, C/C++ Web framework, and any number of other organisations depending upon all the other appalling and idiotic Web frameworks?
Admin
Computer Science used to be in math departments before it became large enough for it’s own. From my experiences while there is still some overlap, a typical undergraduate degree in computer science would not be sufficient for the type of work a mathematician would do. Unless if it’s discrete math.
Admin
And how exactly would that be helped by casting the return value of malloc?
The safest way, is:
double * x; x = malloc(10 * sizeof *x);
That way if the type of x gets changed, the malloc size is adjusted automatically.
Admin
I'm curious. In what kind of situation is this the case? I assume it's for code that is repeated many, MANY times over - but where would such a large cost saving come in? A 3D rendering engine? Telco?
Admin
I should note that the Philips web site is horrendous, and when I tried to use it, it crashed multiple times, and kept logging me off. I don't recall how I got it to work, but I finally managed to register my device so that it would work online.
Admin
Real time data processing off a particle accelerator ^_^
I believe an event came in every 5ns.
Admin
I actually had to stop and think about this one for a bit. The two main arguments.. catching an incorrect malloc prototype and keeping sizes in sync are kinda one-off effects.
The big deal is that the author of C++ didn't understand C very well and completely missed WHY you don't cast from malloc, and thus changed the functionally in his own version of the language.
C is a strongly typed language, it's actually one of it's selling point. In order to miss-assign types you have to go through the additional hoop of casting, telling the language 'yes, I know what I'm doing and I really DO want to do this'. By using an explicit cast after a malloc one is signaling 'something is wrong here and I am forcing it to do something it doesn't want to'. It's a big red flag that something is going on and is probably going wrong.
Admin
Admin
Admin
I think the real question here is, how do I make my Resume/CV look real nice and pretty?
Admin
I'd suspect that adding puppies to a resume would actually decrease your chances of being considered, wouldn't it? Definitely the resume should be nicely formatted and easy to read, and maybe triangles and lines in background are OK, but anything more than that would be bad.
Admin
I tend to include a picture of a handgun. Position filled!
Admin
Was the "C" guy Jeff Atwood?
Admin
Look at the most recent job worked and how long they worked there.
Sounds like you are letting YOUR prejudices through...
Admin
It may not be very OO, but it should be valid compilation wise (unless it should read "sizeof(S)" as opposed to "sizeof ( struct S )"
Admin
When I see such a list on a resume, it really tells me you know about 3% of what there is to know in all these subjects.
Guess what? I got absolutely no use for somebody like that.
Admin
I got plenty of use for someone like that. My office needs a coffe-boy (or girl)
Admin
Unfortunately, it's all too common for resumes to be judged based on appearance rather than content. It would be a bigger surprise if the more qualified applicant got the job despite a less appealing design.