Author Topic: How to distinguish betwen Code:Blocks and Visual Studio in code  (Read 4758 times)

Offline Borneq

  • Multiple posting newcomer
  • *
  • Posts: 45
I want to compile code under Code:Blocks as well as under Visual Studio. Is problem: Code:Blocks uses snprintf only whereas Visual Studio only sprintf_s (will be well if Code:Blocks uses both).
How distinguish betwen Code:Blocks and Visual Studio ? Is any conditional? How to list all conditionals like _WIN32 ?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Borneq

  • Multiple posting newcomer
  • *
  • Posts: 45
Re: How to distinguish betwen Code:Blocks and Visual Studio in code
« Reply #2 on: June 14, 2011, 12:32:21 pm »
Code:Blocks uses usually GCC. GCC uses snprintf, Visual Studio sprintf_s.
Thanks for http://sourceforge.net/apps/mediawiki/predef/index.php?title=Compilers
« Last Edit: June 14, 2011, 12:33:58 pm by Borneq »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to distinguish betwen Code:Blocks and Visual Studio in code
« Reply #3 on: June 14, 2011, 01:29:51 pm »
C::B can use VC++, no problem (on windows).
VC++ supports snprintf, probably it is called _sntprintf...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]