what is the difference between portable C, posix C and windows C ???
portable C, posix C and windows C
Collapse
This topic is closed.
X
X
-
asitTags: None -
user923005
Re: portable C, posix C and windows C
On Oct 7, 10:34 pm, asit <lipu...@gmail. comwrote:Portable means that it will compile on many platforms.what is the difference between portable C, posix C and windows C ???
To accomplish this, you need some kind of a standard.
The ANSI/ISO C standard creates one kind of portability for C
programs.
Posix is another kind of standard. It allows some additional
fascilities to be standardized that will not work without the Posix
assumption.
There is no such thing as Windows C. There are C compilers that run
on Windows. Mingw GCC, Microsoft and Intel all make nice C compilers
for Windows.
HTH
-
asit
Re: portable C, posix C and windows C
user923005 wrote:Does portable C is as faster as posix C.On Oct 7, 10:34�pm, asit <lipu...@gmail. comwrote:>what is the difference between portable C, posix C and windows C ???
Portable means that it will compile on many platforms.
To accomplish this, you need some kind of a standard.
The ANSI/ISO C standard creates one kind of portability for C
programs.
>
Posix is another kind of standard. It allows some additional
fascilities to be standardized that will not work without the Posix
assumption.
>
There is no such thing as Windows C. There are C compilers that run
on Windows. Mingw GCC, Microsoft and Intel all make nice C compilers
for Windows.
>
HTH
I mean to say that does portable C is converted directly to assembly
language....avo iding any intermediate conversion ???
Comment
-
user923005
Re: portable C, posix C and windows C
On Oct 7, 10:42 pm, asit <lipu...@gmail. comwrote:Portability and speed have no real connection.user923005 wrote:>On Oct 7, 10:34 pm, asit <lipu...@gmail. comwrote:what is the difference between portable C, posix C and windows C ???>Portable means that it will compile on many platforms.
To accomplish this, you need some kind of a standard.
The ANSI/ISO C standard creates one kind of portability for C
programs.>Posix is another kind of standard. It allows some additional
fascilities to be standardized that will not work without the Posix
assumption.
http://en.wikipedia.org/wiki/POSIX>There is no such thing as Windows C. There are C compilers that run
on Windows. Mingw GCC, Microsoft and Intel all make nice C compilers
for Windows.>HTH
Does portable C is as faster as posix C.
Generally, the best optimizers process the file in several passes.I mean to say that does portable C is converted directly to assembly
language....avo iding any intermediate conversion ???
Comment
-
Ian Collins
Re: portable C, posix C and windows C
asit wrote:But windows does provide its own library extensions.>
user923005 wrote:>On Oct 7, 10:34�pm, asit <lipu...@gmail. comwrote:>Portable means that it will compile on many platforms.>>what is the difference between portable C, posix C and windows C ???
>To accomplish this, you need some kind of a standard.
>The ANSI/ISO C standard creates one kind of portability for C
>programs.
>>
>Posix is another kind of standard. It allows some additional
>fascilities to be standardized that will not work without the Posix
>assumption.
>http://en.wikipedia.org/wiki/POSIX
>>
>There is no such thing as Windows C. There are C compilers that run
>on Windows. Mingw GCC, Microsoft and Intel all make nice C compilers
>for Windows.
>>
POSIX is best be viewed as an extension to the C standard library, notDoes portable C is as faster as posix C.
I mean to say that does portable C is converted directly to assembly
language....avo iding any intermediate conversion ???
an extension to the language. So in the general case, there isn't a
performance difference. There are exceptions such as constraints
imposed by threading, but you shouldn't worry about those.
--
Ian Collins.
Comment
-
James Kuyper
Re: portable C, posix C and windows C
asit wrote:"portable" is ill-defined. As a practical matter, portability is awhat is the difference between portable C, posix C and windows C ???
matter of degree, not an absolute yes-or-no. Some code is more portable
that other code. Very little code is portable everywhere, and most such
code is of limited utility.
Some people consider code portable if it can work as intended without
modification on every machine that has exactly the same software and
hardware configuration as the one they are using (I'm exaggerating; but
it's not as much of an exaggeration as it should be). Other people
consider code to be portable only if it works as intended under every
version of C still in use, on every platform for which a C compiler is
available (this is close to the standard that a lot of GNU code is
written to). Most people use a definition somewhere in between those two
extremes.
My own definition is that C code is portable if it would work as
intended if translated by any implementation of C while operating in a
mode that conforms fully and meaningfully to at least one version of the
official C standard. "conforms meaningfully" means that the
implementation doesn't take advantage of the abundance of weasel wording
that's present in the standard to conform to the standard in technical
sense, without actually implementing the language and library described
by that standard.
A key phrase here is "work as intended". If the behavior is intended to
be different on different platforms, then it is working as intended if
the behavior varies in the way that it's supposed to vary. This is the
key difference between my concept of "portable" and the standard's
definition of "strictly conforming". One consequence of this difference
is that it's not possible to be certain that code is "portable" by my
definition, unless you know what the intended behavior is. Strict
conformance can be verified solely by inspection of the code itself.
POSIX C code is C code that fully conforms to some version of the POSIX
standard. All of my code is POSIX C with that definition. You might
argue that it isn't truly a POSIX program unless it relies on at least
one POSIX-specific feature; I've only written a little bit of code that
qualifies as POSIX code, if you add in that requirement.
I don't write or read Windows C, so I don't feel competent to define it;
you might want to wait for a response from a Windows programmer. I would
presume that it means code which will work as intended when compiled and
executed on at least one Windows machine. You might argue that it isn't
truly a Windows program unless it relies upon at least one
Windows-specific feature.
Comment
-
James Kuyper
Re: portable C, posix C and windows C
asit wrote:
....The advantage of portability is that the code can be compiled on manyDoes portable C is as faster as posix C.
I mean to say that does portable C is converted directly to assembly
language....avo iding any intermediate conversion ???
different machines; it has nothing to do with speed. In some cases,
making code portable is incompatible with making it fast for a
particular platform, because it means that you can't use
platform-specific features that could achieve greater speed.
Comment
-
Malcolm McLean
Re: portable C, posix C and windows C
"asit" <lipun4u@gmail. comwrote in message
news:af76c910-0cb0-426c-bf39-cbb5bcb18cf6@n1 g2000prb.google groups.com...Portable C depends only on the standard library.what is the difference between portable C, posix C and windows C ???
>
Posix C depends on the Posix library, which is widely available on UNIX
systems but not generally on small systems.
Windows C depends on the Microsoft Windows C API, a very rich set of library
calls to open and manage windows and do much else besides.
--
Free games and programming goodies.
Comment
-
dj3vande@csclub.uwaterloo.ca.invalid
Re: portable C, posix C and windows C
In article <2d1Hk.1474$yI6 .1447@nwrddc01. gnilink.net>,
James Kuyper <jameskuyper@ve rizon.netwrote:On the other hand, portable code is easy to speed up by recompiling it>asit wrote:
>...>>Does portable C is as faster as posix C.
>I mean to say that does portable C is converted directly to assembly
>language....av oiding any intermediate conversion ???
>The advantage of portability is that the code can be compiled on many
>different machines; it has nothing to do with speed. In some cases,
>making code portable is incompatible with making it fast for a
>particular platform, because it means that you can't use
>platform-specific features that could achieve greater speed.
for newer and fastar machines. The closer you get to the nonportable
end of the spectrum, the harder that gets.
For ISO9899 (Standard C) + POSIX or (to a slightly lesser degree)
ISO9899+Win32, you can probably get almost all of the benefits along
this axis of using ISO9899 only, since POSIX systems tend to run on
most kinds of hardware and Win32 runs on the hardware family that's
pushing the speed envelope most aggressively. But if you have inline
x86 assembly scattered through your code, you'll only be able to take
advantage of newer/faster CPUs in one particular family (though
currently a very popular one) unless you're willing to rewrite your
code. If that inline x86 assembly was filled with speed hacks
optimized for the 386^W486^WPenti um^WP-II^WP-4 architecture, you might
even end up having to rewrite it just to keep up with portable C code
compiled with a decent architecture-aware optimizer.
So if it needs to run "As fast as possible for the foreseeable future",
as opposed to "As fast as possible right now", platform-specific
features become less valuable.
dave
--
Dave Vandervies dj3vande at eskimo dot com
Is that a specific "typical 64-bit machine", or a generalized 64
bit machine?
--Walter Roberson in comp.lang.c
Comment
-
dj3vande@csclub.uwaterloo.ca.invalid
Re: portable C, posix C and windows C
In article <_91Hk.1473$yI6 .1079@nwrddc01. gnilink.net>,
James Kuyper <jameskuyper@ve rizon.netwrote:
That's almost how I would define `Windows C', and I program for Windows>POSIX C code is C code that fully conforms to some version of the POSIX
>standard. All of my code is POSIX C with that definition. You might
>argue that it isn't truly a POSIX program unless it relies on at least
>one POSIX-specific feature; I've only written a little bit of code that
>qualifies as POSIX code, if you add in that requirement.
>
>I don't write or read Windows C, so I don't feel competent to define it;
>you might want to wait for a response from a Windows programmer. I would
>presume that it means code which will work as intended when compiled and
>executed on at least one Windows machine.
at my day job.
"On at least one Windows machine" is a rather weak requirement, though;
as a matter of professional pride, I would insist that Windows C code
I'm responsible for be able to compile on *any* Windows machine with
the appropriate tools, and run (and work as intended) on *any* Windows
machine (or, at least, any Windows machine meeting a well-defined and
reasonable set of additional requirements, such as "Has Windows version
at least X and at least Y amount of storage available to the program"),
not just "at least one".
If it doesn't rely on at least one Windows-specific feature, there'sYou might argue that it isn't
>truly a Windows program unless it relies upon at least one
>Windows-specific feature.
not much point in calling it a Windows program, though it's not
strictly incorrect to do so (especially if it's intended to run on
Windows).
I would be more likely to explicitly partition it into "C" (or possibly
"portable C", if the qualifier is useful in distinguishing multiple
flavors of C under discussion), which is C code that will behave as
intended when compiled and run with any correct C implementation, and
"C+Win32", which is C code intended to be compiled and linked against
an implementation of the Win32 API which will behave as expected when
that environment is correctly implemented.
(Similarly, I would partition what you call "POSIX C" into "C" and
"C+POSIX".)
But all of this is just barely marginally on-topic here. CLC exists
for the discussion of "C", also known as "portable C"; for "POSIX C",
or "C+POSIX", or whatever you call it, there's comp.unix.progr ammer;
and for "Windows C" or "C+Win32" or whatever you call *that*, there's
comp.os.ms-windows.program mer.win32; and for other platforms there are
other platform-specific newsgroups...
dave
--
Dave Vandervies dj3vande at eskimo dot com
You should post to CLC or CLC++ if you are interested in having highly
qualified people help you with your code, making it correct, efficient,
hansome, suave and good with the ladies. --Brian Rodenborn in CLC
Comment
-
Ian Collins
Re: portable C, posix C and windows C
Malcolm McLean wrote:That depends on what you define as small. Posix is supported (or even>
"asit" <lipun4u@gmail. comwrote in message
news:af76c910-0cb0-426c-bf39-cbb5bcb18cf6@n1 g2000prb.google groups.com...Portable C depends only on the standard library.>what is the difference between portable C, posix C and windows C ???
>>
Posix C depends on the Posix library, which is widely available on UNIX
systems but not generally on small systems.
complied to) by a number of popular RTOS.
--
Ian Collins.
Comment
-
Flash Gordon
Re: portable C, posix C and windows C
Ian Collins wrote, On 08/10/08 07:59:Yes. However there can be further confusion because a number ofasit wrote:But windows does provide its own library extensions.>user923005 wrote:>>On Oct 7, 10:34�pm, asit <lipu...@gmail. comwrote:
>>>what is the difference between portable C, posix C and windows C ???
>>Portable means that it will compile on many platforms.
>>To accomplish this, you need some kind of a standard.
>>The ANSI/ISO C standard creates one kind of portability for C
>>programs.
>>>
>>Posix is another kind of standard. It allows some additional
>>fascilities to be standardized that will not work without the Posix
>>assumption.
>>http://en.wikipedia.org/wiki/POSIX
>>>
>>There is no such thing as Windows C. There are C compilers that run
>>on Windows. Mingw GCC, Microsoft and Intel all make nice C compilers
>>for Windows.
>>>
compilers use the C library provided by MS giving access to all the
extensions MS provide in it but other implementations use their own
implementation of the C library so whilst the probably provide full
access to the Windows API they may not provide all of the functions (or
may provide them with different names and/or semantics) as some Windows
programmers would expect.
There are also other constraints the POSIX standard puts on the compiler>>Does portable C is as faster as posix C.
>I mean to say that does portable C is converted directly to assembly
>language....av oiding any intermediate conversion ???
POSIX is best be viewed as an extension to the C standard library, not
an extension to the language. So in the general case, there isn't a
performance difference. There are exceptions such as constraints
imposed by threading, but you shouldn't worry about those.
itself, such as I believe the number of bits in a byte (it must be 8
which is one of the values allowed by the C standard). If programming
specifically for POSIX one might (for good reasons) take advantage of
some of these constraints.
--
Flash Gordon
If spamming me sent it to smap@spam.cause way.com
If emailing me use my reply-to address
See the comp.lang.c Wiki hosted by me at http://clc-wiki.net/
Comment
-
user923005
Re: portable C, posix C and windows C
On Oct 8, 1:10 pm, Ian Collins <ian-n...@hotmail.co mwrote:<OT-Aside>Malcolm McLean wrote:
>>"asit" <lipu...@gmail. comwrote in message
news:af76c910-0cb0-426c-bf39-cbb5bcb18cf6@n1 g2000prb.google groups.com...what is the difference between portable C, posix C and windows C ???>Portable C depends only on the standard library.
Posix C depends on the Posix library, which is widely available on UNIX
systems but not generally on small systems.
That depends on what you define as small. Posix is supported (or even
complied to) by a number of popular RTOS.
You can even run Posix on Windows using this:
KIPAS899 login adalah salah satu platform pasaran pusat togel terlengkap 2026 dengan hadiah terbesar saat ini yang memberikan fitur alternatif link situs daftar terupdate 7/24 jam nonstop.
Unfortunately, most config.guess files have no idea what SUA is.
This is helpful in that regard:
All the windows Posix solutions have some speed bumps.
Mingw has no fork().
Cygwin has confusing usage terms.
SUA has trouble running ./configure
I guess the thing to do is get Linux if you really want Posix on PC
hardware.
IMO-YMMV
</OT-Aside>
Comment
-
Ian Collins
Re: portable C, posix C and windows C
user923005 wrote:Erm no, if you want Posix on PC hardware, get (Open)Solaris.I guess the thing to do is get Linux if you really want Posix on PC
hardware.
>
--
Ian Collins.
Comment
-
Richard Heathfield
Re: portable C, posix C and windows C
John H. Guillory said:
<snip>
That sounds like "QuickWin" to me. It was a feature of early versions ofNot to get off topic, but what would you say about someone who uses a
Windows C compiler to compile Console mode programs or graphical
"Console" programs that are basically a window opened up that outputs
standard C style printf/puts to a virtual console that looks like a
white windows window?
Visual C, and it sounded quite promising - "turn your console program into
a Windows program with one click of the mouse!" - but of course it turned
out to be exactly what you describe: a console window with delusions of
grandeur.
--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Comment
Comment