Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Is it just me or just Microsoft?

Reply
Thread Tools

Is it just me or just Microsoft?

 
 
Neelesh Bodas
Guest
Posts: n/a
 
      07-15-2007
On Jul 15, 8:37 am, "Alf P. Steinbach" <(E-Mail Removed)> wrote:
> * 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

 
Reply With Quote
 
 
 
 
Default User
Guest
Posts: n/a
 
      07-15-2007
Neelesh Bodas wrote:

> On Jul 15, 8:37 am, "Alf P. Steinbach" <(E-Mail Removed)> wrote:
> > * 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
 
Reply With Quote
 
 
 
 
Richard Heathfield
Guest
Posts: n/a
 
      07-15-2007
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
 
Reply With Quote
 
Bo Persson
Guest
Posts: n/a
 
      07-15-2007
Dave Vandervies wrote:
:: In article <469981e9$0$30620$(E-Mail Removed)>,
:: GeekBoy <(E-Mail Removed)> wrote:
:::
::: "Ark Khasin" <(E-Mail Removed)> wrote in message
::: newsbfmi.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


 
Reply With Quote
 
Rolf Magnus
Guest
Posts: n/a
 
      07-15-2007
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.

 
Reply With Quote
 
=?ISO-8859-1?Q?Erik_Wikstr=F6m?=
Guest
Posts: n/a
 
      07-15-2007
On 2007-07-15 10:59, Bo Persson wrote:
> Dave Vandervies wrote:
> :: In article <469981e9$0$30620$(E-Mail Removed)>,
> :: GeekBoy <(E-Mail Removed)> wrote:
> :::
> ::: "Ark Khasin" <(E-Mail Removed)> wrote in message
> ::: newsbfmi.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
 
Reply With Quote
 
=?ISO-8859-1?Q?Erik_Wikstr=F6m?=
Guest
Posts: n/a
 
      07-15-2007
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(7; //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
 
Reply With Quote
 
red floyd
Guest
Posts: n/a
 
      07-15-2007
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.
 
Reply With Quote
 
Dave Vandervies
Guest
Posts: n/a
 
      07-15-2007
In article <j_wmi.46532$(E-Mail Removed)> ,
red floyd <(E-Mail Removed)> wrote:
>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 http://www.velocityreviews.com/forums/(E-Mail Removed)
I use the term "sandbox" to describe a "closed" environment,
because it's shorter to type than "hermetically sealed".
--infobahn in comp.programming
 
Reply With Quote
 
GeekBoy
Guest
Posts: n/a
 
      07-16-2007

"Ark Khasin" <(E-Mail Removed)> wrote in message
news:Ssfmi.3739$yx4.1551@trndny08...
> GeekBoy wrote:
>> "Ark Khasin" <(E-Mail Removed)> wrote in message
>> newsbfmi.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(7; //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.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it just me or just Microsoft? Ark Khasin C Programming 42 07-16-2007 11:59 PM
How do I clean a virus within an inbox or just clean only that infectedattachment or LOCATE AND delete just that attachment ? Vinayak Firefox 1 08-14-2006 06:19 PM
Is there a Python MVC that works just as well with just CGI, or FCGI? walterbyrd Python 1 04-10-2006 07:57 PM
allow you to move just about any music to your iPud, MP3 player , or just burn it to disk sbcmynews Computer Support 4 05-01-2005 03:53 PM
Just bought a Digital Rebel just 1 question RacerX Digital Photography 7 11-21-2003 01:51 PM



Advertisments