By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,911 Members | 1,137 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,911 IT Pros & Developers. It's quick & easy.

Is it just me or just Microsoft?

P: n/a
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?

Thank you,
Ark
Jul 15 '07 #1
Share this Question
Share on Google+
40 Replies


P: n/a

"Ark Khasin" <ak*****@macroexpressions.comwrote in message
news:Pbfmi.4059$7R4.1870@trndny09...
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

Jul 15 '07 #2

P: n/a
GeekBoy wrote:
"Ark Khasin" <ak*****@macroexpressions.comwrote in message
news:Pbfmi.4059$7R4.1870@trndny09...
>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
Jul 15 '07 #3

P: n/a
In article <46***********************@roadrunner.com>,
GeekBoy <ge**@com.comwrote:
>
"Ark Khasin" <ak*****@macroexpressions.comwrote in message
news:Pbfmi.4059$7R4.1870@trndny09...
>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.

I'm unable to duplicate it with MSVC6, so it looks to me like it's
probably something specific to the OP's installation; but in any case
it's highly unlikely to be a deliberate non-compliance with the standard.
dave

--
Dave Vandervies dj******@csclub.uwaterloo.ca
There are some rather entertaining LARTs that can be applied if you have the
will and moderately deep pockets to play with lawyers.
--Peter Corlett in the scary devil monastery
Jul 15 '07 #4

P: n/a
Dave Vandervies wrote:
<snip>
MSVC6 complies to ISO 9899:1990 as well as any other compiler does when
it's invoked properly.
<snip>

You must be kidding.
- Ark
Jul 15 '07 #5

P: n/a
In article <i1gmi.4064$7R4.1703@trndny09>,
Ark Khasin <ak*****@macroexpressions.comwrote:
>Dave Vandervies wrote:
<snip>
>MSVC6 complies to ISO 9899:1990 as well as any other compiler does when
it's invoked properly.
<snip>

You must be kidding.
- Ark
No, I'm not. I have a lot of reasons to hate Microsoft, but their C
compiler isn't one of them.
dave

--
Dave Vandervies dj******@csclub.uwaterloo.ca
There are some rather entertaining LARTs that can be applied if you have the
will and moderately deep pockets to play with lawyers.
--Peter Corlett in the scary devil monastery
Jul 15 '07 #6

P: n/a
Alf P. Steinbach wrote:
* Ark Khasin:
>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?

Visual C++ __LINE__ is broken in many versions of that compiler, when
you compile with support for "Edit and Continue" (option /ZI), and that
may be what you're up against. As an alternative you can use
non-standard __COUNTER__. And the only thing that makes that compiler
specific information slightly on-topic here is that it's an issue with
Marginean's original scope guard (which is of general interest to the
C++ community), which needs to be modified for use with Visual C++.
Alas, __COUNTER__ is not defined in 6.0. The rest works as explained.
Thank you so very much!
- Ark

Jul 15 '07 #7

P: n/a
Dave Vandervies wrote:
MSVC6 complies to ISO 9899:1990 as well as any other compiler does when
it's invoked properly.
Really? Do they have:

- New C99 math functions like lrint, lrintf, round etc ?
- A C99 compliant snprintf function?
- C99 variadic macros?

Erik
--
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"Circle is-a ellipse? Ellipse is-a circle? Ellipse has-a circle?"
-- Tommy McGuire
Jul 15 '07 #8

P: n/a
Erik de Castro Lopo wrote:
Dave Vandervies wrote:
>MSVC6 complies to ISO 9899:1990 as well as any other compiler does when
it's invoked properly.

Really? Do they have:

- New C99 math functions like lrint, lrintf, round etc ?
- A C99 compliant snprintf function?
- C99 variadic macros?
And what do C99 functions have to do with C90 (OP spec'ed 9899:1990)
compliance?
Jul 15 '07 #9

P: n/a
On Jul 15, 8:37 am, "Alf P. Steinbach" <al...@start.nowrote:
* Alf P. Steinbach:
* Ark Khasin:
Due to a peculiar need (code instrumentation) I came across unexpected
behavior of Visual Studio 6.0 and 2005 (doing the same thing):
[unnecessary stuff chopped off]
int main(int argc)
{
static int y=MYNUM(21); //error!
Just another suggestion: your "main" signature is incorrect.
Not really. The following code compiles well on comeau online:

int main(int argc)
{
return 1;
}

I guess the standard expects the implementations to support the two
"standard" signatures, but it also says that other signatures are
allowed as far as return type is int:

<quote>
3.6.1.2:
(main) function shall not be overloaded. It shall have a return type
of type int, but otherwise its type is implementation-defined. All
implementations shall allow both of the following efinitions of
main.....
</quote>

-N

Jul 15 '07 #10

P: n/a
Neelesh Bodas wrote:
On Jul 15, 8:37 am, "Alf P. Steinbach" <al...@start.nowrote:
* Alf P. Steinbach:
* Ark Khasin:
>int main(int argc)
>{
> static int y=MYNUM(21); //error!
Just another suggestion: your "main" signature is incorrect.
I guess the standard expects the implementations to support the two
"standard" signatures, but it also says that other signatures are
allowed as far as return type is int:
So? That just makes it non-standard extension. It is incorrect within
the scope of either of these newsgroups.

Brian
Jul 15 '07 #11

P: n/a
Erik de Castro Lopo wrote:
Dave Vandervies wrote:
>MSVC6 complies to ISO 9899:1990 as well as any other compiler does when
it's invoked properly.

Really? Do they have:

- New C99 math functions like lrint, lrintf, round etc ?
- A C99 compliant snprintf function?
- C99 variadic macros?
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.
Jul 15 '07 #12

P: n/a
Neelesh Bodas said:

<snip>
<quote>
3.6.1.2:
(main) function shall not be overloaded.
No, there is no section 3.6.1.2 in the Standard. There is a section
3.6(1), however, which says: "byte - addressable unit of data storage
large enough to hold any member of the basic character set of the
execution environment". I'm not sure how this is relevant to the fact
that your main declarator is broken.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 15 '07 #13

P: n/a
Erik de Castro Lopo wrote:
:: Dave Vandervies wrote:
::
::: MSVC6 complies to ISO 9899:1990 as well as any other compiler
::: does when it's invoked properly.
::
:: Really? Do they have:
::
:: - New C99 math functions like lrint, lrintf, round etc ?
:: - A C99 compliant snprintf function?
:: - C99 variadic macros?

That wasn't available in 1990, was it?
Bo Persson
Jul 15 '07 #14

P: n/a
Dave Vandervies wrote:
:: In article <46***********************@roadrunner.com>,
:: GeekBoy <ge**@com.comwrote:
:::
::: "Ark Khasin" <ak*****@macroexpressions.comwrote in message
::: news:Pbfmi.4059$7R4.1870@trndny09...
:::: 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.

VC6 predates both of them, which you will notice if you try some
templated code, for example.
Bo Persson
Jul 15 '07 #15

P: n/a
Erik de Castro Lopo wrote:
Dave Vandervies wrote:
>MSVC6 complies to ISO 9899:1990 as well as any other compiler does when
it's invoked properly.

Really? Do they have:

- New C99 math functions like lrint, lrintf, round etc ?
- A C99 compliant snprintf function?
- C99 variadic macros?
What does this all have to do with C90 compliance?

Jul 15 '07 #16

P: n/a
Richard Heathfield wrote:
Neelesh Bodas said:

<snip>
><quote>
3.6.1.2:
(main) function shall not be overloaded.

No, there is no section 3.6.1.2 in the Standard. There is a section
3.6(1), however, which says: "byte - addressable unit of data storage
large enough to hold any member of the basic character set of the
execution environment". I'm not sure how this is relevant to the fact
that your main declarator is broken.
It seems that both of you didn't notice that this thread goes to both
comp.lang.c and comp.lang.c++. It's likely that you are talking about
different standards.

Jul 15 '07 #17

P: n/a
On 2007-07-15 06:41, Erik de Castro Lopo wrote:
Dave Vandervies wrote:
>MSVC6 complies to ISO 9899:1990 as well as any other compiler does when
it's invoked properly.

Really? Do they have:

- New C99 math functions like lrint, lrintf, round etc ?
- A C99 compliant snprintf function?
- C99 variadic macros?
Of course not, he said ISO 9899:1990, that's 9 years to early.

--
Erik Wikström
Jul 15 '07 #18

P: n/a
On 2007-07-15 10:59, Bo Persson wrote:
Dave Vandervies wrote:
:: In article <46***********************@roadrunner.com>,
:: GeekBoy <ge**@com.comwrote:
:::
::: "Ark Khasin" <ak*****@macroexpressions.comwrote in message
::: news:Pbfmi.4059$7R4.1870@trndny09...
:::: 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.

--
Erik Wikström
Jul 15 '07 #19

P: n/a
red floyd wrote:
>Really? Do they have:

- New C99 math functions like lrint, lrintf, round etc ?
- A C99 compliant snprintf function?
- C99 variadic macros?

And what do C99 functions have to do with C90 (OP spec'ed 9899:1990)
compliance?
Ooops, I misread the OP's statement.

Erik
--
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
Diana West for President of the United States
http://www.washtimes.com/op-ed/20060...1447-7758r.htm
http://www.washtimes.com/op-ed/20060...4015-5082r.htm
Jul 15 '07 #20

P: n/a
On 2007-07-15 03:59, Ark Khasin wrote:
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.

--
Erik Wikström
Jul 15 '07 #21

P: n/a
Martin Ambuhl <ma*****@earthlink.netwrites:
Erik de Castro Lopo wrote:
>Dave Vandervies wrote:
>>MSVC6 complies to ISO 9899:1990 as well as any other compiler does when
it's invoked properly.
Really? Do they have:
- New C99 math functions like lrint, lrintf, round etc ?
- A C99 compliant snprintf function?
- C99 variadic macros?

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".

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jul 15 '07 #22

P: n/a
Bo Persson wrote:
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.
Jul 15 '07 #23

P: n/a
In article <j_*******************@newssvr21.news.prodigy.net> ,
red floyd <no*****@here.dudewrote:
>Bo Persson wrote:
>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.
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.

>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.
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

--
Dave Vandervies dj******@csclub.uwaterloo.ca
I use the term "sandbox" to describe a "closed" environment,
because it's shorter to type than "hermetically sealed".
--infobahn in comp.programming
Jul 15 '07 #24

P: n/a

"Ark Khasin" <ak*****@macroexpressions.comwrote in message
news:Ssfmi.3739$yx4.1551@trndny08...
GeekBoy wrote:
>"Ark Khasin" <ak*****@macroexpressions.comwrote in message
news:Pbfmi.4059$7R4.1870@trndny09...
>>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.

Jul 16 '07 #25

P: n/a
GeekBoy wrote:
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
--
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"There are two ways of constructing a software design. One way is
to make it so simple that there are obviously no deficiencies
and the other is to make it so complicated that there are no
obvious deficiencies." -- C A R Hoare
Jul 16 '07 #26

P: n/a
GeekBoy said:
"Ark Khasin" <ak*****@macroexpressions.comwrote...
>GeekBoy wrote:
>>"Ark Khasin" <ak*****@macroexpressions.com>...

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.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 16 '07 #27

P: n/a
Erik de Castro Lopo wrote, On 16/07/07 04:06:
GeekBoy wrote:
>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.
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.
--
Flash Gordon
Jul 16 '07 #28

P: n/a
On 16 Jul, 06:59, Richard Heathfield <r...@see.sig.invalidwrote:
GeekBoy said:
"Ark Khasin" <akha...@macroexpressions.comwrote...
GeekBoy wrote:
"Ark Khasin" <akha...@macroexpressions.com>...
>>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.
Oh lifes so tough, lifes so bad, and theres nothing I can do but moan,
moan, moan...

regards
Andy Little
Jul 16 '07 #29

P: n/a
Flash Gordon wrote:
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
--
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
Failure is not an option. It comes bundled with your Microsoft
product.
Jul 16 '07 #30

P: n/a
On Jul 16, 5:06 am, Erik de Castro Lopo <er...@mega-nerd.comwrote:
GeekBoy wrote:
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.
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.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Jul 16 '07 #31

P: n/a
On Jul 15, 6:41 am, Erik de Castro Lopo <er...@mega-nerd.comwrote:
Dave Vandervies wrote:
MSVC6 complies to ISO 9899:1990 as well as any other compiler does when
it's invoked properly.
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.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Jul 16 '07 #32

P: n/a
James Kanze wrote:
On Jul 16, 5:06 am, Erik de Castro Lopo <er...@mega-nerd.comwrote:
GeekBoy wrote:
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.

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>

Jul 16 '07 #33

P: n/a
James Kanze said:

<snip>
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.

<snip>
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! :-)

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 16 '07 #34

P: n/a
Richard Heathfield wrote:
:: GeekBoy said:
::: "Ark Khasin" <ak*****@macroexpressions.comwrote...
:::: GeekBoy wrote:
::::: "Ark Khasin" <ak*****@macroexpressions.com>...
::::::
:::::: 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
Jul 16 '07 #35

P: n/a
On Mon, 16 Jul 2007 12:44:45 +0200, Bo Persson wrote:
Richard Heathfield wrote:
:: GeekBoy said:
::: "Ark Khasin" <ak*****@macroexpressions.comwrote... :::: GeekBoy
wrote:
::::: "Ark Khasin" <ak*****@macroexpressions.com>... ::::::
:::::: 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.

--
Lionel B
Jul 16 '07 #36

P: n/a
Erik de Castro Lopo wrote:
GeekBoy wrote:
>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.
So? Why should we/he care about C?
Jul 16 '07 #37

P: n/a
On Jul 15, 8:06 pm, Erik de Castro Lopo <er...@mega-nerd.comwrote:
GeekBoy wrote:
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.
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).

Jul 16 '07 #38

P: n/a
user923005 said:

<snip>
I would be interested to know if a fully validated C99 compiler exists
(one that correctly implements each and every language feature).
http://www.peren.com/pages/cvsa_isocvpl.htm may be of interest to you. I
don't know how thorough their test suite is, of course.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 16 '07 #39

P: n/a
user923005 wrote:
On Jul 15, 8:06 pm, Erik de Castro Lopo <er...@mega-nerd.comwrote:
>GeekBoy wrote:
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.

I have never seen a compiler that actually conforms the the ISO C99
standard, though many of them implement subsets of it.
The microsoft compiler implements close to zero of C99.

The GNU compiler implements a very large part of C99 and is available
for a bunch of operating systems and CPUs.

Erik
--
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"Web (hosting), security and high-performance computing are the
three areas where Linux has more strength." --
Bob Muglia, senior VP in charge of Windows Server development.
http://news.com.com/Microsoft+target...3-5735805.html
Jul 16 '07 #40

P: n/a
On Jul 16, 3:43 pm, Erik de Castro Lopo <er...@mega-nerd.comwrote:
user923005 wrote:
On Jul 15, 8:06 pm, Erik de Castro Lopo <er...@mega-nerd.comwrote:
GeekBoy wrote:
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.
I have never seen a compiler that actually conforms the the ISO C99
standard, though many of them implement subsets of it.

The microsoft compiler implements close to zero of C99.

The GNU compiler implements a very large part of C99 and is available
for a bunch of operating systems and CPUs.
I have both of these compilers and use them on a daily basis.
A compiler that offers "most of C99" is not more useful than one that
does not.
If we cannot count on full functionality, it makes no sense to program
to that standard since we do not know if some piece it is going to
work or not.
In addition, unless all compilers we use have features supported
across all platforms we must be very careful about how we use it.

I have to compile code for:
MVS
OS/390
OS/400
z/OS
OpenVMS VAX/ALPHA/ITANIUM
HP/Ux
Windows
Linux
Solaris
SunOS
Aix
BSD variants
SCO
Ultrix
along with both 32 & 64 bit variants for {mostly} all of these...
and lots of others I can't think of right now.

If I have a source code base that needs to be compiled on all of these
systems, I cannot simply hope that some part of the language will be
implemented.

We use GCC on about 2/3 of the platforms and commercial compilers on
the other 1/3 (usually because GCC is not available, but occasionally
because the commercial compilers generate much better code).

Jul 17 '07 #41

This discussion thread is closed

Replies have been disabled for this discussion.