linux has typeof, how can i get the same function for windows?

B

baumann@pan

hi all,


gcc tools support typeof for c language, how can i get the same
function for the windows program?


thanks in advance.

baumann @ pan
 
K

Keith Thompson

baumann@pan said:
gcc tools support typeof for c language, how can i get the same
function for the windows program?

typeof is a gcc extension; it's not part of the C standard.

There are several ways to use gcc on Windows. It's also possible that
some Windows compilers may provide the same language extension, or a
similar one.

Probably a Windows-specific newsgroup is the best place to get more
information.
 
T

Tim Prince

Keith said:
typeof is a gcc extension; it's not part of the C standard.

There are several ways to use gcc on Windows. It's also possible that
some Windows compilers may provide the same language extension, or a
similar one.

Probably a Windows-specific newsgroup is the best place to get more
information.
Check the documentation of your candidate Windows C compilers, or ask on
their on-line forum. Intel C apparently restricts this extension to their
linux compiler. Generally, commercial linux C compilers support only
standard C plus Microsoft extensions.
 
W

Walter Roberson

:if so, it is compiler specific. there is no general solution of this
:problem?

There is no general solution for embedded systems. There is, though,
a general solution for hosted systems.

For hosted systems, the solution is to change your compilation options
in a minor way: instead of having your IDE or makefile or whatever
compile your program directly, have it compile one of the portable C
compilers (or interpreters), and take the output of that and use it to
compile one of the virtual machine emulators for a platform supported
by gcc, and then run that virtual machine emulator to compile gcc,
and then use gcc within the virtual machine emulator to compile
your source, and then run that executable within the virtual
environment. You likely need to toss in a cross-compilation of the
portable C compiler to the emulated virtual machine.

gcc is written to be compilable in standard C instead of requiring
gcc extensions, but you can't just go for gcc -directly- because
you don't have the necessary data tables for every environment.
So all you have to do is push in the intermediate layer of the
emulated windows environment -- the emulators are written in C,
and their "bios" and OS are just data files that are available.
No problem.


If this doesn't sound like the right solution for you, then if
you want to produce portable code, you should avoid 'typeof'.
 
C

CBFalconer

C

CBFalconer

baumann@pan said:
if so, it is compiler specific. there is no general solution of
this problem?

If what is so? What is it? What problem?

Articles should always quote sufficient context to stand by
themselves. If you must use the broken google interface, see the
operation details in my sig, below.
 
P

Peter Nilsson

Please don't delete the context of your replies.


Walter said:
There is no general solution for embedded systems. There is,
though, a general solution for hosted systems.

Huh?

In standards terms, the difference between a hosted and
freestanding implementation is that the former has tighter
requirements, particularly with regard to support for required
library routines.

There's no reason to think that a compiler might not be in a
position to support typeof as an extension, purely because it
is part of a freestanding implementation.
 
B

baumann@pan

If what is so? What is it? What problem?

Articles should always quote sufficient context to stand by
themselves. If you must use the broken google interface, see the
operation details in my sig, below.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
 
J

James McIninch

Use GCC under Windows.

baumann@pan said:
hi all,


gcc tools support typeof for c language, how can i get the same
function for the windows program?


thanks in advance.

baumann @ pan
 
B

baumann@pan

the project will be compiled under visual studio2003 dot net IDE.
is it not too hard to alter the configuration of the IDE?
 
W

Walter Roberson

Walter Roberson wrote:
In standards terms, the difference between a hosted and
freestanding implementation is that the former has tighter
requirements, particularly with regard to support for required
library routines.
There's no reason to think that a compiler might not be in a
position to support typeof as an extension, purely because it
is part of a freestanding implementation.

Freestanding implementations are not required to support the I/O
library at all, whereas hosted implementations are. Therefore any
generalized strategy that requires producing output
for a further phase is not certain to be usable on a freestanding
implementation.

The strategy I outlined relies upon Turing Equivilence and the
availability of portable C compilers and of portable virtual
machine emulators for at least one environment that gcc will
run under.

gcc is not available for all environments, partly because
the necessary defining instruction tables are not available. But gcc
is available for at least one environment which can be emulated by
a portable virtual machine, so you compile a typeof-needing program by
gcc running inside the virtual machine that you bootstrapped.


You could probably handle the sequence more directly by finding
one of the portable C compilers and modifying it to accept typeof;
that modified C compiler would be in portable C [portable to any
hosted implementation] so you could compile it with the hosting C
compiler and use the result to compile the program that needed typeof.
You wouldn't get a "native executable", you'd get something that
ran in the virtual machine of the modified portable C compiler... but
it -is- a generalized solution implementable in portable C.
Not a -pretty- solution by any means, but the OP asked for a general
solution without constraining the bounds of possibilities.
 
M

Mark McIntyre

the project will be compiled under visual studio2003 dot net IDE.

then you'll need to ask in an MS group if that compiler supports
typeof
is it not too hard to alter the configuration of the IDE?

to do what ? use gcc to compile ? :)

FWIW with some care its quite possible to compile your code with gcc,
but use the MS IDE to develop it. We do this all the time at work.
 

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,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top