|
In case you didn't want to go to the trouble of running code, the problem is that the C++ preprocessor does a simple text replacement, so something like 6 * ADD(3, 5) becomes 6 * 3 + 5, which is 23, not 48 like you would think to look at it. The usual way you would correct this is to add some brackets in the macro definition: #define ADD(x, y) (x + y)
|
# ? Aug 24, 2016 13:27 |
|
|
# ? May 9, 2024 23:56 |
|
Oh, I should have known that.
|
# ? Aug 24, 2016 13:39 |
|
An even "more correct" way to write that macro would be #define ADD(x,y) ((x)+(y)) since, again, you can be bit in the rear end for certain values of x or y. While macros are not evil per se, they do open a can of worms if left unchecked, a relatively hard to debug can of worms.
|
# ? Aug 24, 2016 14:07 |
|
hobbesmaster posted:Unions are also classes if we're talking about C++ trivia. At a language implementation level they're quite similar; it's just that the offset from the memory address of the variable for all their members is 0 and the size is the largest size of any given member rather than the sum of the sizes of the members (modulo alignment adjustments).
|
# ? Aug 24, 2016 14:14 |
|
Hammerite posted:If you want to determine whether the candidate knows the difference between a class and a struct, why not ask them "what's the difference between a class and a struct?" I was asked but then followed up with this more trivia type questions, it was really a bit tenuous. They still want to interview me which suggests there are not a lot of C++ people really looking for jobs.
|
# ? Aug 25, 2016 00:46 |
|
MrMoo posted:I was asked but then followed up with this more trivia type questions, it was really a bit tenuous. They still want to interview me which suggests there are not a lot of C++ people really looking for jobs. There just aren't enough programmers in existence in general.
|
# ? Aug 25, 2016 01:53 |
|
MrMoo posted:I was asked but then followed up with this more trivia type questions, it was really a bit tenuous. They still want to interview me which suggests there are not a lot of C++ people really looking for jobs. There also aren't all that many C++ jobs out there.
|
# ? Aug 25, 2016 15:05 |
|
And this thread is making me glad that I'm not a C++ programmer
|
# ? Aug 26, 2016 14:22 |
|
Tomahawk posted:And this thread is making me glad that I'm not a C++ programmer lol if you think Java is better than C++. I wish Java had half the niceties of C++, also why am I writing Java I did not sign up for this.
|
# ? Aug 26, 2016 15:27 |
|
leper khan posted:lol if you think Java is better than C++. I've been trying to learn myself a scala and have been repeatedly pleasantly surprised at how much useful stuff's floating around out there in the jvm ecosystem, and in particular how nice it is to have a maven for managing dependencies instead of the c++'s world "good luck" policy.
|
# ? Aug 26, 2016 17:34 |
|
leper khan posted:lol if you think Java is better than C++.
|
# ? Aug 26, 2016 19:45 |
|
fritz posted:I've been trying to learn myself a scala and have been repeatedly pleasantly surprised at how much useful stuff's floating around out there in the jvm ecosystem, and in particular how nice it is to have a maven for managing dependencies instead of the c++'s world "good luck" policy. ExcessBLarg! posted:But is your average C++ codebase "better" than your average Java codebase? How much C++ do you encounter in the wild that's modern C++11? I feel like C++ allows for a wider range on the "better" spectrum, ranging from horrifying to pleasant. Java seems to condense the range around annoying. I'd rather work with tools that can be nice, rather than tools that prevent me from losing limbs but remain generally unpleasant.
|
# ? Aug 26, 2016 20:01 |
|
ExcessBLarg! posted:But is your average C++ codebase "better" than your average Java codebase? How much C++ do you encounter in the wild that's modern C++11? fritz posted:I've been trying to learn myself a scala and have been repeatedly pleasantly surprised at how much useful stuff's floating around out there in the jvm ecosystem, and in particular how nice it is to have a maven for managing dependencies instead of the c++'s world "good luck" policy.
|
# ? Aug 30, 2016 16:14 |
|
necrobobsledder posted:I vividly remember the problems I had just getting stuff to compile and link with shared libraries and so forth circa 2001 gcc 2 It hasn't gone away, we have to compile for a bunch of platforms (including android and windows) and it can be a real pain sometimes.
|
# ? Aug 30, 2016 19:00 |
|
necrobobsledder posted:(I'm struggling with a programmer pun on "Arbeit macht frei"). Arbeit makefile is as close as I can get
|
# ? Aug 31, 2016 00:24 |
|
TopherCStone posted:Arbeit makefile is as close as I can get free free macht Arbeit?
|
# ? Aug 31, 2016 12:55 |
|
|
# ? May 9, 2024 23:56 |
|
I've been really lucky, every interview I've done from either side has been pretty good. The only exception was for my first job moving from low-level C stuff to web dev about ten years ago. All their questions were stuff I'd learned by googling 'asp.net interview questions' the night before, and then their lead asked how I'd add a repeater control to a page and I just said 'um...I'd type 'repeater' into the aspx file?' wondering if it was a trick question or maybe they'd ask me to expand on the page life-cycle or something, but nope, that was it, job done. When the recruiter got back to me he said they though I sounded like someone who could really 'go places' in the company and offered me a senior role
|
# ? Sep 7, 2016 10:05 |