How would you define a language issue in C++?

Discussion in 'Mac Programming' started by chrono1081, Aug 25, 2011.

  1. chrono1081 macrumors 604


    Jan 26, 2008
    Isla Nublar
    Hi guys,

    I'm preparing interview questions for myself for a job interview (my first possibility for a programming job :D) and one of the questions I see being asked is:

    "What are some language issues in C++."

    Unfortunately I have yet to find anything on Google actually pointing out an issue so I thought of some that may be an issue but I'd like some feedback on what you guys think.

    For C++, I would say a few different issues would be:

    1. Complexity of the language. It takes quite a while to do something in C++ vs say Objective-C.

    2. No built in garbage collection (although in my opinion thats not really an issue since C++ is meant for speed, I would assume garbage collection was omitted on purpose).

    and thats about all I can come up with. I'm sure there are some that I know that I am not thinking of. Can anyone shed some light on this? I want to go into this interview as prepared as possible.
  2. Hansr macrumors 6502a

    Apr 1, 2007
    1) Can be abstracted away with frameworks and libraries, not really a language issue.

    2) It's a language design choice and that way for a reason not a issue. Smart pointers make this a non-issue anyway.

    The question is would you answer with just plain C++ reasoning, C++ 0x reasoning or C++ + STL + Boost etc reasoning? Because once you start adding frameworks into the mix pretty all things people complain about can be ignored, e.g. char* vs std::string etc.

    Most of what can be called language issues in C++ is more about knowing how the compiler treads things and coding appropriately.


    To give insight into the question you might want to read through Scott Meyers's books and check the following links:
  3. iHutch105 macrumors member

    Aug 8, 2011
    That's an annoyingly vague, yet very typical of a job interview, kind of question.

    Do they mean syntactically? Conceptually?

    I would say lack of garbage collection is a fair answer as an issue. Although it's a design choice and, yes, can be overcome with a smart pointer class, it's still common for many C++ programmers to run into memory leak problems caused by bad memory management.

    I guess an issue can only really be measured by programmer skill. A good programmer will be aware of most common issues with a language, thus making them not real issues. A less skilled programmer is more likely to trip up on these avoidable things, which would technically make them an issue.

    Whether that's a "language issue" or not, I'm not so sure.
  4. ScoobyMcDoo macrumors 65816

    Nov 26, 2007
    Austin, TX
    Well, if someone were to ask me that question in an interview, I would probably belittle their question by telling them that any "weakness" they can point out in the language itself could be easily debated.

    The whole "doesn't have garbage collection" to me is a strength, rather than a weakness. I write time critical software, and whenever I have had to deal with a language which uses garbage collection, such as smalltalk or java, it has always caused more grief than anything.

    About the only thing I can think of to complain about now is the direction the standards committees are going. There was a time that you could throw any C code at a C++ compiler and it would do just fine. With some of the latest standards, that may be lost, as some language features are starting to diverge.
  5. iHutch105 macrumors member

    Aug 8, 2011
  6. Sander macrumors 6502

    Apr 24, 2008
    Not having a garbage collector is a huge pro - it means the runtime is deterministic.

    I would say the biggest problem is its inheritance from C. Many of the critiques of the language stem from this - if C++ started with a clean slate it could have had nicer syntax, a safer type system, etc. But on the other hand, it would probably not have become as popular as it did, because the advantage is that it can easily interface to the enormous C code base which is out there.

    If you have time, pick up "Imperfect C++" by Wilson. Also, the annotated reference manual - it turns out that for each item C++ gets bashed for, there has been thoughtful consideration and all alternatives turned out to have a weak spot somewhere, even though these considerations may look far-fetched. As an example, having automatic range checking would lead to safer code, yes - but it would also cost a few extra cycles. People who don't care for these cycles are not C++'s target audience.

    I say it's an interesting question for an interview though. It is provocative; you'll get to see where the interviewee falls between "who cares" via "passoniate" to downright "stubborn". Which is good to know.

    (Edit: You can google for "C++ critique" and see if you agree with the points raised.)
  7. chrono1081 thread starter macrumors 604


    Jan 26, 2008
    Isla Nublar
    Thanks guys for all the tips and suggestions :)

    I'm really hoping I land this job, but even if I don't its a win/win situation so it won't be too bad.

    If I land the job that would be awesome since it'll be my first programming job.

    If I don't land the job I will still know what a programming test is like, what areas I need to work on improving the most, and I will be able to finish school a lot easier. Once I'm done with school and I feel my skills have improved enough I'll just apply again and hope for the best.

    Obviously I want the job badly but you know how the saying goes, if at first you don't succeed...
  8. ghellquist macrumors regular

    Aug 21, 2011
    Stockholm Sweden
    Some input

    Hmm. Often enough the questions in a job interview are less about what is really asked but more about how the person reasons. So here are some alternative answers.

    It is after all only a tool. Often there are better tools depending on circumstances.

    It depends a lot on the organization and people. Coding C++ probably takes more discipline in the organization than many other languages as it is rather simple to make a mess of a software project.

    It depends on the platform. Writing user interface code a Mac is better done in another language.

    Or of you want to focus on the language as such.

    Too low level. It takes a lot of code to get a simple website up and running.

    Too high level. A lot of important things are hidden and difficult to debug. Overloading operators can make a mess of things.

    Programs written in C++ are difficult to maintain unless strict coding rules are followed.

  9. Sander macrumors 6502

    Apr 24, 2008
    If you said the things below in an interview with me, I'd have some questions in return...

    I would ask you: "A website? Isn't that like saying a hammer is a bad tool because it's difficult to paint with?"

    This is my personal pet peeve. I'd make you come up with examples.
  10. ehoui macrumors regular

    Jan 27, 2011
    Ask yourself this: besides having lots of experience and a deep background in C++, do you think you'd have a chance debating a language feature of C++ with someone who might know a lot more than you? Probably not. Soft position and give yourself lots of wiggle room if you get a question like this. Be open to learning something new in the interview if the interviewer is trying to teach you something along the way (which they may be judging you on). If the interviewer is a jerk, you are not going to win this point unless you happen to guess correctly.
  11. hap macrumors newbie

    Sep 8, 2003
    Just a few things you may want to remember.

    No language is a magic bullet but they are still bullets

    This means you can probably make your language of choice do what you need.

    Try not to get involved in any debates on which language is getter. Everyone has an opinion and this sort of holy war is not something I have seen anyone win

    there are 50 solutions to every problem. one solution may be better for memory consumption another for speed etc. There is no RIGHT answer but each developer will generally pick a different one so try not to be married to any particular solution when you dicuss your approach to an issue

    Let us know how it went.

  12. ghellquist macrumors regular

    Aug 21, 2011
    Stockholm Sweden
    Sorry first, trying to multi quote on my iPad did not work for me. Still a learning curve.

    And I do believe that if at an interview I got this back, I would probably say:

    I believe Thats my point. C++ can be used for a lot of things but it is not always the best tool. Tell me more why you ask me the question about language issues, they clearly can be overcome.

    A side note.
    Now, this assumes the job is to do application programming, not to design a new language or develop a new compiler. Again, the right people in the right place.

    Sorry, this is not meant to start a language debate. Only suggesting that in an interview the question is not always meant to be answered with facts, it might be a way to probe for patterns of thought and to start discussion and not a debate.

  13. Mac_Max macrumors 6502

    Mar 8, 2004
    This is really true of any and all languages. The reputation of VB and being garbage is in a lot of ways because the programers are all over the place.

    At work I program in C# and the project I've taken over the maintenance of is a total mess because there were no coding standards and best practices are rarely followed.

    It doesn't matter if you're using Assembly, C, VB, ObjC, Java, HTML, etc... coding standards are important.
  14. foidulus macrumors 6502a

    Jan 15, 2007
    There are scads(C++ is my least favorite language precisely because its so messy) you could always go with security(no bounds checking means it's quite easy to "smash the stack")

    But my personal pet peeve of course is the "friend" keyword. It violates pretty much every tenet of object-oriented programming and sort of makes even bothering to declare protected/private fields/methods moot.
  15. gnasher729 macrumors P6


    Nov 25, 2005
    Not at all. It is like the difference between giving a key to your home to a trusted friend, and leaving the door open. The first one is a lot more secure.
  16. chrono1081, Aug 30, 2011
    Last edited: Aug 30, 2011

    chrono1081 thread starter macrumors 604


    Jan 26, 2008
    Isla Nublar
    Thank you guys so much for all the tips and help :)

    I have my interview today. Wish me luck! :)

    Whether I get the job or not it will still be a win win situation (although obviously I'd prefer the job.) If I get it I will have landed my first programming job and be super happy. If I don't land it I will have an easier time finishing school (I'm in my last semester) and will have the experience of what is expected during a programming interview and I can use that to prepare myself for the next potential job opportunity.

    Thanks again! :)

    EDIT: Yea....I totally blew the interview....nervousness set in which usually NEVER happens to me and I was tripping over easy questions which I could answer just fine now. I also tripped over the programming test which was super easy as well. ARGH! Oh well, now I know what a programming interview is like so I can better prepare myself for the next one!

Share This Page