Jump to content
  • Advertisement
Sign in to follow this  
dpadam450

My interview question:

This topic is 3299 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

If you have a global variable and put the name "static" in front of it, what does this change? I said nothing. I guess I missed the point of this question?

Share this post


Link to post
Share on other sites
Advertisement
So it makes it local to the file. So this was such a big question to ask because if you don't know that, you obviously don't know how to program. God damn.

Share this post


Link to post
Share on other sites
Quote:
Original post by dpadam450
So it makes it local to the file.
More exactly, it makes it local to the translation unit. (A static global declared in a header file is most certainly not just local to the header file.)
Quote:
So this was such a big question to ask because if you don't know that, you obviously don't know how to program. God damn.
If you don't know that, you obviously haven't spent much time getting to know your language of choice, or interacting with others' code in that language.

Share this post


Link to post
Share on other sites
It may or may not be a bogus question depending on various factors. If you stated on your resume that you were highly proficient with C or C++ then yeah, getting that answer wrong would look a little bad because it would make it seem like you weren't that proficient. If it was just one small component of the interview out of many similar language construct questions it probably wasn't that important. Other concerns are how many people are applying for the position. If there are a LOT of people trying to get this job then, all other things being equal, why not drop the candidate that can't answer the question correctly? This isn't exactly highly obscure trivia. A lot of programs, particuarly some C programs I've worked with, use global static variables. I don't like 'em, but they're there.

It could just be a crap interview though.

Share this post


Link to post
Share on other sites
"or interacting with others' code in that language."

Well I've only worked on games at school and I've never had anyone do this or have any teacher mention it. I've never professionally done anything so that would be the reasoning. It still kinda sounds sloppy, being that it is still global. I dont know.

Either way, I looked it up after the guy above sent me a link. 5 seconds I know what it means. Really this is a big deal?

Share this post


Link to post
Share on other sites
Quote:
Original post by dpadam450

Either way, I looked it up after the guy above sent me a link. 5 seconds I know what it means. Really this is a big deal?


If you plan on using C or C++ for anything non-trivial, you better know your statics. They are both languages where something can compile, but then fail miserably during linking.

Personally, I avoid static context like plague, but that is not a luxury one can afford in any or at least most real world projects.

The basics of C++ are here. It would be prudent to understand each and every point listed there.

Share this post


Link to post
Share on other sites
Quote:
Original post by dpadam450
Either way, I looked it up after the guy above sent me a link. 5 seconds I know what it means. Really this is a big deal?
They don't care about static in particular. They asked you the question to gauge whether you really knew a lot about the language, or whether you only had a limited, working knowledge. Apparently they judged correctly. But perhaps if you whine about it, it'll make things better!

Share this post


Link to post
Share on other sites
Quote:
Original post by dpadam450
Either way, I looked it up after the guy above sent me a link. 5 seconds I know what it means. Really this is a big deal?


As an interviewer I don't care about you looking it up. I care that you GUESSED the answer. You should have said: "I don't know" if you had been talking to me.

I don't want people guessing, I want people that know what they know and what they don't know. Never guess, be honest about knowledge. And when you are afraid of answering "I don't know" state it differently: "I am not entirely sure, I would have to look it up. I never used it as I never use global or static variables." (if that is true)

Share this post


Link to post
Share on other sites
Well my answer actually was that it would be the same. It is all just compiler time and that a static variable is really just a global variable at run-time, it stays in memory at the exact same location and not on the stack, so declaring a global variable to be "static" (not on the stack) -> that is what a global variable is already.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!