Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
Hi,

I am asked an basic question of coding in an interview

Qus: How can you write a code which is not compiler dependent i.e You have to write a code which you don't know client will generate exe for in Windows environment or in Linux environment. How can you do that?

Any one have a clue...

Thanks
Posted

1 solution

Most code is compiler dependent, c and c# for example require their own compilers.

However the question is mostly valid for cxx (c, c++) languages which can have a multitude of different compilers (gcc, ms, etc.), the only real way to get your code to compile is to go with the base and not use compiler specific or platform specific extensions like writing in ANSI C for example.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900