Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / C Compiler / IDE

Author
Message
Michael P
19
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 6th Dec 2010 12:44 Edited at: 6th Dec 2010 12:44
I'm about to do a test as part of a job application for the programming language C. I have never used C, but have used C++ alot. I think its a good idea for me to have a play with C before doing the test even though apparently its very similar to C++, so what is the best compiler / IDE that will do straight C only (and not poison me with C++ constructs).

And is it reasonable to say that C is pretty much just C++ without objects, or are there other subtle / significant differences that I should be aware of?

EddieB
20
Years of Service
User Offline
Joined: 29th Sep 2004
Location: United Kingdom
Posted: 7th Dec 2010 00:28
Read up on Memory Management in C... can cause a lot of headaches if done wrong.

http://bizarreon.com
Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 7th Dec 2010 01:46
Almost any C++ compiler will have a compiler setting to disable the '++' part (including VC++).

Main differences:
- No new/delete. Use "malloc(sizeof(type))" and cast to desired type and 'free(ptr)'.
- IIRC, you can't do 'for (int i = 0; i < 10; i++)', you have to declare 'i' before the 'for' statement.
- You must prefix type names with the type of type, ie. 'struct mystruct' must always be referred to like that, never as just 'mystruct'. eg: 'struct mystruct myvar;'
- Typedefs remove this restriction 'typedef struct mystruct myotherstruct' lets you use 'myotherstruct' as a type.
- No code inside types (ie. member functions).
- No inheritance
- No bool type or true/false constants
- No function overloading

To name but a few

[b]
The Wilderbeast
19
Years of Service
User Offline
Joined: 14th Nov 2005
Location: UK
Posted: 7th Dec 2010 08:27 Edited at: 7th Dec 2010 08:28
[Edit] Scratch that, silly question.

Michael P
19
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 7th Dec 2010 13:39 Edited at: 7th Dec 2010 14:03
Damn this sounds more awkward than I thought... Well I'm not quite sure what the tests going to be like, but according to people on the interwebs it has no time limit so in theory I can't fail? I'm going to go and buy a book today and then do the actual test on Friday, can't go wrong with that.

[edit]
So I started playing with some C code in VC but have a strange issue with free (I'm not sure if its supposed to work like this):


The last line won't compile if free has been used previously. Is this normal or is VC being naughty?

Benjamin
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 7th Dec 2010 19:50
Try declaring all of your variables at the top of the function.
Jeku
Moderator
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Vancouver, British Columbia, Canada
Posted: 8th Dec 2010 00:48
Quote: "- No function overloading"


Really? It's been a long time since I've touched C, but I'm surprised it doesn't support function overloading


Senior Web Developer - Nokia
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 8th Dec 2010 07:45
Quote: "Really? It's been a long time since I've touched C, but I'm surprised it doesn't support function overloading
"

Yeah, I didn't believe it, but a quick search told me that it is. Thought that was strange.

Your mother has been erased by a mod because it's larger than 600x120
BearCDP
15
Years of Service
User Offline
Joined: 7th Sep 2009
Location: NYC
Posted: 8th Dec 2010 09:49
But it DOES support variable argument lists, which is weird to me.

Check out this WIP flash game from the Global Game Jam!
Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 8th Dec 2010 16:24 Edited at: 8th Dec 2010 16:24
C is closer to ASM, and variable argument lists are very easy to do in ASM, so...

[b]
BearCDP
15
Years of Service
User Offline
Joined: 7th Sep 2009
Location: NYC
Posted: 9th Dec 2010 00:32
I suppose that does make sense then I have yet to touch ASM. Next semester!

Check out this WIP flash game from the Global Game Jam!
Michael P
19
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 10th Dec 2010 13:46
I did the test. Was very easy - each question was individually timed and it was all multiple choice. Sometimes it would ask me to say what some code does, so I just typed it out and compiled it .

Login to post a reply

Server time is: 2025-05-30 07:50:02
Your offset time is: 2025-05-30 07:50:02