473,893 Members | 1,874 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is it just me or just Microsoft?

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
40 2769
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 objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Jul 16 '07 #31
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 objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Jul 16 '07 #32
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
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
Richard Heathfield wrote:
:: GeekBoy said:
::: "Ark Khasin" <ak*****@macroe xpressions.comw rote...
:::: GeekBoy wrote:
::::: "Ark Khasin" <ak*****@macroe xpressions.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
On Mon, 16 Jul 2007 12:44:45 +0200, Bo Persson wrote:
Richard Heathfield wrote:
:: GeekBoy said:
::: "Ark Khasin" <ak*****@macroe xpressions.comw rote... :::: GeekBoy
wrote:
::::: "Ark Khasin" <ak*****@macroe xpressions.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
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
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
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
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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

99
6283
by: Jim Hubbard | last post by:
It seems that Microsoft not only does not need the classic Visual Basic developer army (the largest army of developers the world has ever seen), but now they don't need ANY Windows developer at a small or mid-sized business. http://groups-beta.google.com/group/microsoft.public.msdn.general/browse_thread/thread/9d7e8f9a00c1c7da/459ca99eb0e7c328?q=%22Proposed+MSDN+subscription+changes%22&rnum=1#459ca99eb0e7c328 Damn! To be that...
3
1751
by: Rahul Agarwal | last post by:
Hi In our web page we use a combination of HTML and server side controls and some of them have a custom attribute based on which we need to find and replace the values once the HTML is ready. For e.g. <LABEL DICTCODE="XYZ">Some text</LABEL> At run time just before the complete HTML is sent to the client-side I want to get hold of the HTML so that I can find and replace all the HTML elements
7
2181
by: GeorgeAtkins | last post by:
I want to create a web-based form or page that consists of a series of formatted questions and answers. The form will resemble an existing paper form. When the form is filled in, I want the user to submit the form via e-mail and have the complete form with answers sent, not just the data. That is, the recipient should be able to open the attachment and see (and print) the complete, formatted form. It seems to me that solutions simply...
0
9832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11245
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10929
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10469
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8025
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7175
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5859
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6066
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3293
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.