0

I've cleaned and compiled successfully on ARM a portable program that has been coded in C99. Any of my source file fails to compile using /ZW.

All that Visual Studio is telling me is that I can't compile my files with /ZW.

Is this possible to use C99 code as a Runtime Component?

What makes a file compile or not with /ZW?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
Léon Pelletier
  • 2,701
  • 2
  • 40
  • 67
  • 2
    MSVC is not a C99 compiler. You will have to remove any coding practices that rely on C99 before porting to MSVC. – Jonathan Leffler Aug 04 '13 at 20:21
  • 1
    @JonathanLeffler: Sad but true -- though apparently Microsoft is planning to add some C99 support in the next version of MSVC. And you should post that as an answer. – Keith Thompson Aug 04 '13 at 20:23

1 Answers1

2

Current versions of MSVC are not C99 compilers — though that may change in the future as it supports C11 and therefore, of necessity, some parts of C99 too.

At the moment, though, you will have to remove any coding practices that rely on C99 before porting to MSVC. Also note that the behaviour of _snprintf() in the Microsoft runtime is not the same as the behaviour required by C99 for snprintf() (and the renaming is another problem in its own right). There are also differences between some of the 'safer' functions defined as optional in C11 in Annex K (Bounds checking interfaces) and the Microsoft runtime versions of the functions with the same name. See also Do you use the TR 24731 'safe' functions.

Community
  • 1
  • 1
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
  • Wow, ok... Is there any well-known C99 to C89 converter. All codes I want to use are pretty huge. Otherwise, it seems I'll have invent this tool? – Léon Pelletier Aug 04 '13 at 21:54
  • 1
    I'd probably use `gcc -std=c89 -pedantic` on the code to find the scope of the problems you face. Much of C99 is the same as C89. However, there are changes too. Things like VLAs (variable length arrays) and FAMs (flexible array members) will have to be reworked (probably dynamic allocation and 'the struct hack', respectively). Modern initialization (designated initializers, compound literals) will have to be replaced with old-fashioned code. Theoretically, you'll have to remove calls to C99 functions; in practice, you may be able to use the MS renamed runtime functions. Etc. – Jonathan Leffler Aug 04 '13 at 22:42