Re: Visual C++ support of C99 by using "C++ mode" (/TP)



On Mar 31, 1:20 pm, "Harald van Dijk" <true...@xxxxxxxxx> wrote:
albert....@xxxxxxxxx wrote:
The following is valid C99 code:

/************* c_test.c ***************/
#include <stdio.h>
#include <stdbool.h>
#include <limits.h>

int main( void )
{
bool b = true;
if (b)
printf("hello world\n");

char c = 5;
printf("%hhd\n", c);

int size = INT_MAX / 10000;
printf("%d\n", size);
char a[size];
a[0] = 'a';
a[1] = 'b';
a[2] = '\0';
printf("%s\n", (char *)&a);

return 0;
}

The above C99 code can be compiled on VC++, by just commenting the 2nd
line (see below!)

In other words, by making it valid C++ and invalid C99.

What's your point?

My point is:
Maby the difference between VC++ in C++ mode and C99 is marginal.
(In the example above, only the header is not known in the current VC+
+ (but bool is supported anyway))

And maby this difference will get even smaller, if VC++ adopts (or
conforms more closely to) newer C++ standards.

Albert

.



Relevant Pages

  • function error
    ... bool processdrecord(ofstream& prnfile, ofstream& validdata, char* ... // process the customer code ...
    (comp.lang.cpp)
  • Access violation error
    ... bool IRRecordvalidlength ... bool CheckAllNumeric(const char * string) ... irrecord* CheckDigit(ofstream& prnfile, ofstream& validdata, char* ... // process the customer code ...
    (comp.lang.cpp)
  • Re: Access violation error
    ... > access violation error. ... > drecord Newdrecord; ... > bool IRRecordvalidlength ... > bool CheckFloatNumber(const char* string) ...
    (comp.lang.cpp)
  • Re: OCX(COM) Interop...Passing pointer of structure to function
    ... Shell MegaPack: GUI Controls For Drop-In Windows Explorer like File/Folder ... For the second one, I used to marshall the bool to 1 byte counterpart, but ... char UserName; ...
    (microsoft.public.dotnet.languages.csharp)
  • Exception raised in GCI subroutine: Access Violation
    ... The routine aborts with an 'Exception raised inGCIsubroutine: ... int (since theGCIwon't support BOOL) ... I char* ... I BOOL (ditto) ...
    (comp.databases.pick)