Is it just me or just Microsoft?

?

=?ISO-8859-1?Q?Erik_Wikstr=F6m?=

Dave Vandervies wrote:
:: In article <[email protected]>,
:::
::: :::: Due to a peculiar need (code instrumentation) I came across
:::: unexpected behavior of Visual Studio 6.0 and 2005 (doing the
:::: same thing):
::
:: [...]
::
:::: Any suggestions?
:::
::: Yeah, buy a compiler that is ANSI/ISO compliant
::
:: MSVC6 complies to ISO 9899:1990 as well as any other compiler does
:: when it's invoked properly. Its C++ compiler pre-dates the last
:: two versions
:: of the C++ standard and I don't have any experience with newer
:: versions, but I would be surprised if they don't at least closely
:: approximate compliance.

There are only two versions of the C++ standard, 1998 and 2003.

And a C standard released 1990.
 
?

=?ISO-8859-1?Q?Erik_Wikstr=F6m?=

Due to a peculiar need (code instrumentation) I came across unexpected
behavior of Visual Studio 6.0 and 2005 (doing the same thing):

#include <stdio.h>
#define CAT1(a,b) a ## b
#define CAT(a,b) CAT1(a,b)
#define MYNUM(n) CAT(n,__LINE__)
const int x = MYNUM(35); //OK
int z=MYNUM(78); //OK
int main(int argc)
{
static int y=MYNUM(21); //error!
//6.0: error C2064: term doesn't evaluate to a function
//2005 adds: taking 26451848 arguments.

printf("%d %d\n", x, y );
return 0;
}

Doesn't matter if I compile as C or as C++ (if I am not mistaken, the
preprocessor is the same).
No problem with another compiler (IAR for ARM)...
[Microsoft claims strict standard compliance in the C++ department]

Any suggestions?

It works fine for me in VS2005, I suggest you check your compiler options.
 
K

Keith Thompson

Martin Ambuhl said:
Only the truly perverse think that "complies to ISO 9899:1990" implies
the presence on C99 additions. In no way does their absence
invalidate Mr. Vandervies's claim.

Or someone who made a simple mistake and mis-read "ISO 9899:1990" as
"ISO 9899:1999".
 
R

red floyd

Bo said:
Dave Vandervies wrote: t
::
:: MSVC6 complies to ISO 9899:1990 as well as any other compiler does
:: when it's invoked properly. Its C++ compiler pre-dates the last
:: two versions
:: of the C++ standard and I don't have any experience with newer
:: versions, but I would be surprised if they don't at least closely
:: approximate compliance.

There are only two versions of the C++ standard, 1998 and 2003.

VC6 predates both of them, which you will notice if you try some
templated code, for example.

However, the post is about 9899:1990, which is C90. ISO C++ is
14882:1998 or 14882:2003.
 
D

Dave Vandervies

And, with only two versions, those two are the last two, and (as you
noted) it pre-dates both of them.
I think what I actually meant was "last two versions of the language
definition", which would include various editions of Stroustrup as
earlier versions. I don't know enough about either pre-standard C++
or MSVC6's C++ compiler to comment on how well it did with that.

However, the post is about 9899:1990, which is C90. ISO C++ is
14882:1998 or 14882:2003.

I believe he was referring to my comment that the C++ compiler pre-dates
the last two versions of the C++ standard. (It's also pre-dates C99,
but Microsoft isn't doing much worse than a lot of other major compiler
vendors on that one. (That is, Microsoft appears to be doing absolutely
nothing about C99, and a lot of other major compilers seem to be doing
almost nothing.))


dave
 
G

GeekBoy

Ark Khasin said:
GeekBoy said:
Ark Khasin said:
Due to a peculiar need (code instrumentation) I came across unexpected
behavior of Visual Studio 6.0 and 2005 (doing the same thing):

#include <stdio.h>
#define CAT1(a,b) a ## b
#define CAT(a,b) CAT1(a,b)
#define MYNUM(n) CAT(n,__LINE__)
const int x = MYNUM(35); //OK
int z=MYNUM(78); //OK
int main(int argc)
{
static int y=MYNUM(21); //error!
//6.0: error C2064: term doesn't evaluate to a function
//2005 adds: taking 26451848 arguments.

printf("%d %d\n", x, y );
return 0;
}

Doesn't matter if I compile as C or as C++ (if I am not mistaken, the
preprocessor is the same).
No problem with another compiler (IAR for ARM)...
[Microsoft claims strict standard compliance in the C++ department]

Any suggestions?


Yeah, buy a compiler that is ANSI/ISO compliant

Thank you,
Ark
Easier said than done. Many people are bound to MS tools. I guess I
was asking for help with a workaround within MS if known.
- Ark

Then get the newest one. Visual Studio 2005, most compliant and stable yet.
 
E

Erik de Castro Lopo

GeekBoy said:
Then get the newest one. Visual Studio 2005, most compliant and stable
yet.

Yes, that compiler is AFAIK ISO C 1990 compliant, but is not ISO C99
compliant, even 8 years after the standard was ratified.

Erik
 
R

Richard Heathfield

GeekBoy said:
Then get the newest one. Visual Studio 2005, most compliant and stable
yet.

Easier said than done. Not everyone gets to choose their tool chain.
Sometimes those decisions are made by other people - e.g. bosses - and
the choices they make are not always for purely technical reasons.
 
F

Flash Gordon

Erik de Castro Lopo wrote, On 16/07/07 04:06:
Yes, that compiler is AFAIK ISO C 1990 compliant, but is not ISO C99
compliant, even 8 years after the standard was ratified.

You are correct. MS are at one end of the spectrum, having not started
on C99, but they are not alone in that, many compilers have done some
but not all of the work, and a very few actually comply to C99.
 
K

kwikius

GeekBoy said:



Easier said than done. Not everyone gets to choose their tool chain.
Sometimes those decisions are made by other people - e.g. bosses - and
the choices they make are not always for purely technical reasons.

Oh lifes so tough, lifes so bad, and theres nothing I can do but moan,
moan, moan...

regards
Andy Little
 
E

Erik de Castro Lopo

Flash said:
You are correct. MS are at one end of the spectrum, having not started
on C99, but they are not alone in that, many compilers have done some
but not all of the work, and a very few actually comply to C99.

GNU GCC is not fully compliant, but must be getting close to
90% and GCC works on a huge range of operating systems and
processors.

Erik
--
 
J

James Kanze

Yes, that compiler is AFAIK ISO C 1990 compliant, but is not ISO C99
compliant, even 8 years after the standard was ratified.

As far as I know, Microsoft doesn't pretend to continue
supporting C, only C++. What C support is present in the
current versions is only for backwards compatibility with
previous versions.

All of which is irrelevant here. The initial example involved
C90 preprocessor, which was part of C++ long before the C++
standard was adopted, so even VC++ 6.0 should support it.
 
J

James Kanze

Really? Do they have:
- New C99 math functions like lrint, lrintf, round etc ?
- A C99 compliant snprintf function?
- C99 variadic macros?

Are these functions part of ISO 9899:1990?

VC++ 6.0 dates from something like 1997, and so predates the C99
standard considerably. As far as I know, Microsoft has also
dropped support for C, except legacy support for backwards
compatibility; the newer compilers make great strides with
regards to C++, but the C compiler is pretty much unchanged (I
think).

And some one has gone and cross-posted to clc and clc++ again,
so if we don't watch out, we're going to get a lot of people
talking at cross-purposes.
 
S

santosh

James said:
As far as I know, Microsoft doesn't pretend to continue
supporting C, only C++. What C support is present in the
current versions is only for backwards compatibility with
previous versions.

<OT>

They do support the C compiler. They have to, since large parts of the
Windows kernel are in C, and they compile their code with their
compiler.

They just deemed C99 unworthy of efforts for compliance.

</OT>
 
R

Richard Heathfield

James Kanze said:

As far as I know, Microsoft has also
dropped support for C, except legacy support for backwards
compatibility;

That seems fair to me; after all, I've dropped support for Microsoft. If
I need (or want) to write C programs for Windows, I use Visual C 6,
which (if you don't count shovelware in the backs of books) is the last
Microsoft C implementation I shall ever buy.

And some one has gone and cross-posted to clc and clc++ again,
so if we don't watch out, we're going to get a lot of people
talking at cross-purposes.

Welcome to Usenet! :)
 
B

Bo Persson

Richard Heathfield wrote:
:: GeekBoy said:
:::: GeekBoy wrote:
::::: "Ark Khasin" <[email protected]>...
::::::
:::::: Any suggestions?
:::::
::::: Yeah, buy a compiler that is ANSI/ISO compliant
:::::
:::: Easier said than done. Many people are bound to MS tools. I
:::: guess I was asking for help with a workaround within MS if known.
:::
::: Then get the newest one. Visual Studio 2005, most compliant and
::: stable yet.
::
:: Easier said than done. Not everyone gets to choose their tool
:: chain. Sometimes those decisions are made by other people - e.g.
:: bosses - and the choices they make are not always for purely
:: technical reasons.
::

Another option is to get a newer, more compliant, and stable boss.


Bo Persson
 
L

Lionel B

Richard Heathfield wrote:
:: GeekBoy said:
wrote:
::::: "Ark Khasin" <[email protected]>... ::::::
:::::: Any suggestions?
:::::
::::: Yeah, buy a compiler that is ANSI/ISO compliant :::::
:::: Easier said than done. Many people are bound to MS tools. I ::::
guess I was asking for help with a workaround within MS if known. :::
::: Then get the newest one. Visual Studio 2005, most compliant and :::
stable yet.
::
:: Easier said than done. Not everyone gets to choose their tool ::
chain. Sometimes those decisions are made by other people - e.g. ::
bosses - and the choices they make are not always for purely ::
technical reasons.
::
Another option is to get a newer, more compliant, and stable boss.

:) Know what you mean... mine is still in beta and rather buggy.
 
V

Victor Bazarov

Erik said:
Yes, that compiler is AFAIK ISO C 1990 compliant, but is not ISO C99
compliant, even 8 years after the standard was ratified.

So? Why should we/he care about C?
 
U

user923005

Yes, that compiler is AFAIK ISO C 1990 compliant, but is not ISO C99
compliant, even 8 years after the standard was ratified.

I have never seen a compiler that actually conforms the the ISO C99
standard, though many of them implement subsets of it.

I would be interested to know if a fully validated C99 compiler exists
(one that correctly implements each and every language feature).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top