473,854 Members | 1,584 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

code portability

My question is more generic, but it involves what I consider ANSI standard C
and portability.

I happen to be a system admin for multiple platforms and as such a lot of
the applications that my users request are a part of the OpenSource
community. Many if not most of those applications strongly require the
presence of the GNU compiling suite to work properly. My assumption is that
this is due to the author/s creating the applications with the GNU suite.
Many of the tools requested/required are GNU replacements for make,
configure, the loader, and lastly the C compiler itself. Where I'm going
with this is, has the OpenSource community as a whole committed itself to at
the very least encouraging its contributing members to conform to ANSI
standards of programming?

My concern is that as an admin I am sometimes compelled to port these
applications to multiple platforms running the same OS and as the user
community becomes more and more insistent on OpenSource applications will
gotcha's appear due to lack of portability in coding? I fully realize that
independent developers may or may not conform to standards, but again is it
at least encouraged?

11.32 of the FAQ seemed to at least outline the crux of what I am asking.
If I loaded up my home machine to the gills will all open source compiler
applications (gcc, imake, autoconfig, etc....) would my applications that I
compile and link and load conform?
Aug 1 '06
239 10375

"Richard Heathfield" <in*****@invali d.invalidwrote in message
news:jK******** *************** *******@bt.com. ..
Eigenvector said:

<snip>
>Where I'm going
with this is, has the OpenSource community as a whole committed itself to
at the very least encouraging its contributing members to conform to ANSI
standards of programming?

I doubt it very much, unfortunately.
>My concern is that as an admin I am sometimes compelled to port these
applications to multiple platforms running the same OS and as the user
community becomes more and more insistent on OpenSource applications will
gotcha's appear due to lack of portability in coding?

It's entirely possible that they will. Unfortunately, open source code is
not, generally speaking, known for its robustness or portability. In fact,
I can think of only one kind of source base that is less robust and less
portable than open source code - and that's closed source code.
>I fully realize
that independent developers may or may not conform to standards, but
again
is it at least encouraged?

We do our bit, here in comp.lang.c, but I doubt whether it's enough to
make
more than a small difference.

--
Richard Heathfield
Thank you.
Aug 1 '06 #21

"Tom St Denis" <to********@gma il.comwrote in message
news:11******** *************@m 79g2000cwm.goog legroups.com...
Eigenvector wrote:
>What about the programmers who submit to the archives? That is mainly
where
I see massive gcc and imake requirements. In fact I have on occassion
attempted to compile applications - such as gcc using my native Intel or
xlC
compilers without luck. Again this isn't a question on how to compile
GCC,
but rather is the experience that the OpenSource community tries to
conform
to ANSI standards?

GCC is hardly your average OSS project (and Intel C is hardly standard
conforming).
Why do you say that the Intel C compiler isn't standard conforming?

Generally if you don't use any special features of GNU make you should
be "make portable". My makefiles are used in windows, linux, bsd, AIX,
HP-UX, MacOS, etc, etc, etc even though they split between proprietary
make, imake, gmake, etc, etc, etc.

Aim for C89 compliance and you pretty much got things nailed. Keep in
mind that many compilers supported various C99 features even back then.
E.g., long long has been supported for a while and ALL unix C
compilers I've seen support it [even the ones released in the mid 90s].

Avoid VLAs, // comments and the newer header files if you want the
widest possible reach.
Tom

Aug 1 '06 #22
Tom St Denis a écrit :
Eigenvector wrote:
>>What about the programmers who submit to the archives? That is mainly where
I see massive gcc and imake requirements. In fact I have on occassion
attempted to compile applications - such as gcc using my native Intel or xlC
compilers without luck. Again this isn't a question on how to compile GCC,
but rather is the experience that the OpenSource community tries to conform
to ANSI standards?


GCC is hardly your average OSS project (and Intel C is hardly standard
conforming).
You are just speaking nonsense. As specified here:

http://www.intel.com/cd/ids/develope...372.htm?page=4

the intel compiler complies with C99. It is the best compiler for the
intel architecture producing always the best possible code. It is
compatible with gnu's gcc under linux, and with microsoft msvc
under windows.

That compiler is a GREAT piece of software.
Aug 2 '06 #23
jacob navia <ja***@jacob.re mcomp.frwrites:
Tom St Denis a écrit :
[snip]
>GCC is hardly your average OSS project (and Intel C is hardly
standard conforming).

You are just speaking nonsense. As specified here:

http://www.intel.com/cd/ids/develope...372.htm?page=4

the intel compiler complies with C99. It is the best compiler for the
intel architecture producing always the best possible code. It is
compatible with gnu's gcc under linux, and with microsoft msvc
under windows.
"producing always the best possible code"?

Fortunately, the Intel web page you cite doesn't make that absurd
claim. I understand that it does generate good code, but I seriously
doubt that it's "always the best possible".

I'll note in passing that that web page contains the following
statement:

C89 is currently the de facto standard for C applications; however
use of C99 is increasing.

--
Keith Thompson (The_Other_Keit h) 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.
Aug 2 '06 #24
Eigenvector wrote:
[...] I fully realize that
independent developers may or may not conform to standards, but again is it
at least encouraged?
Not really. By its very nature C encourages non-portable programming.
In general, I try to write code portably, but the only thing keeping me
honest is actually compiling my stuff with multiple compilers to see
what happens.

To be completely portable, you also have to support multiple bit sizes
for int, be wary of arbitrary call order of parameters or expression
operands, 6 character unique variable names, use char as either signed
or unsigned, and allow for non-2s complement integers. The problem is
that its hard to find a compiler or platforms that supports variation
in those things.

The easy way to make C code "portable" is to lower your standards for
portability. I.e., just port your code to major compilers (MSVC, gcc
and some Unix cc -- personally, I add Borland C, Turbo C and Watcom C
when I want to really push it), and hope that's good enough.

In general writing any non-trivial amount of code in C for which you
have good certainty about portability is really quite time consuming.
The "open source community" tends to favor "make it work" over "make it
portable".

--
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/

Aug 2 '06 #25
Keith Thompson wrote:
jacob navia <ja***@jacob.re mcomp.frwrites:
>>Tom St Denis a écrit :

[snip]
>>>GCC is hardly your average OSS project (and Intel C is hardly
standard conforming).

You are just speaking nonsense. As specified here:

http://www.intel.com/cd/ids/develope...372.htm?page=4

the intel compiler complies with C99. It is the best compiler for the
intel architecture producing always the best possible code. It is
compatible with gnu's gcc under linux, and with microsoft msvc
under windows.


"producing always the best possible code"?

Fortunately, the Intel web page you cite doesn't make that absurd
claim. I understand that it does generate good code, but I seriously
doubt that it's "always the best possible".

I have *yet* to see any compiler that beats intel's. Sorry.
Aug 2 '06 #26
jacob navia wrote:
Fortunately, the Intel web page you cite doesn't make that absurd
claim. I understand that it does generate good code, but I seriously
doubt that it's "always the best possible".

I have *yet* to see any compiler that beats intel's. Sorry.
GCC 3.4.6 beat Intel v8 in LibTomMath benchmarks. Therefore, GCC is
better than Intel C.

See that's the problem with singular benchmarks they don't mean much.
Intel C is a decent compiler but it allows you to use C++'isms in C
code where you shouldn't be able to. It also lets you use ridicuously
old syntax. And finally, it's inline asm is not 100% compatible with
GCC's asm.

Intel C is OT for this group though, so if you really want to have a
discussion about it email me in private.

Tom

Aug 2 '06 #27
On Wed, 02 Aug 2006 09:49:08 +0200, jacob navia
<ja***@jacob.re mcomp.frwrote:
>Tom St Denis a écrit :
>Eigenvector wrote:
>>>What about the programmers who submit to the archives? That is mainly where
I see massive gcc and imake requirements. In fact I have on occassion
attempted to compile applications - such as gcc using my native Intel or xlC
compilers without luck. Again this isn't a question on how to compile GCC,
but rather is the experience that the OpenSource community tries to conform
to ANSI standards?


GCC is hardly your average OSS project (and Intel C is hardly standard
conforming).

You are just speaking nonsense. As specified here:

http://www.intel.com/cd/ids/develope...372.htm?page=4

the intel compiler complies with C99.
It doesn't say that at all. Did you actually read the article?
It is the best compiler for the
intel architecture producing always the best possible code. It is
compatible with gnu's gcc under linux, and with microsoft msvc
under windows.

That compiler is a GREAT piece of software.
--
Al Balmer
Sun City, AZ
Aug 2 '06 #28
jacob navia <ja***@jacob.re mcomp.frwrites:
Keith Thompson wrote:
>jacob navia <ja***@jacob.re mcomp.frwrites:
>>>Tom St Denis a écrit :
[snip]
>>>>GCC is hardly your average OSS project (and Intel C is hardly
standard conforming).

You are just speaking nonsense. As specified here:

http://www.intel.com/cd/ids/develope...372.htm?page=4

the intel compiler complies with C99. It is the best compiler for the
intel architecture producing always the best possible code. It is
compatible with gnu's gcc under linux, and with microsoft msvc
under windows.
"producing always the best possible code"?
Fortunately, the Intel web page you cite doesn't make that absurd
claim. I understand that it does generate good code, but I seriously
doubt that it's "always the best possible".

I have *yet* to see any compiler that beats intel's. Sorry.
That may well be true, but it's not my point.

You claimed that Intel's compiler produces "always the best possible
code". This is a claim of absolute perfection, and it is well beyond
the current state of the art.

There is a tool that generates absolutely optimial code for a
specified operation on a particular CPU by doing an exhaustive search
of all possible instruction sequences (google "superoptimizer "). It
works only on very short sequences, and it takes a very long time, far
longer than would be practical in a compiler. (It's been used to find
canned sequences that can be emitted by rote by an optimizing
compiler.) Your claim, if taken literally, implies that the Intel
compiler does this kind of optimization for all inputs. Even if it's
the best compiler in the world, I don't believe it's the best compiler
possible.

If you want to be taken seriously, either don't make such far-reaching
claims, or back them up.

I'm not surprised that you've chosen to ignore the following from my
previous article.

| I'll note in passing that that web page contains the following
| statement:
|
| C89 is currently the de facto standard for C applications; however
| use of C99 is increasing.

--
Keith Thompson (The_Other_Keit h) 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.
Aug 2 '06 #29
Al Balmer wrote:
On Wed, 02 Aug 2006 09:49:08 +0200, jacob navia
<ja***@jacob.re mcomp.frwrote:

>>Tom St Denis a écrit :
>>>Eigenvecto r wrote:
What about the programmers who submit to the archives? That is mainly where
I see massive gcc and imake requirements. In fact I have on occassion
attempted to compile applications - such as gcc using my native Intel or xlC
compilers without luck. Again this isn't a question on how to compile GCC,
but rather is the experience that the OpenSource community tries to conform
to ANSI standards?
GCC is hardly your average OSS project (and Intel C is hardly standard
conforming ).

You are just speaking nonsense. As specified here:

http://www.intel.com/cd/ids/develope...372.htm?page=4

the intel compiler complies with C99.


It doesn't say that at all. Did you actually read the article?
You can't read?

In that page the option
-std=c99
is mentioned with explanation:

" C99 conformance and feature support"

in the first table of that page.

And you say:
>
It doesn't say that at all. Did you actually read the article?
There is no blinder person as the one that doesn't want to see!

jacob
Aug 2 '06 #30

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

Similar topics

1
1848
by: Lefevre | last post by:
Hello. I recently discovered that this kind of code : | struct Object | { | string f() { return string("Toto"); } | } | | int main( ... )
0
9901
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9752
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,...
1
10763
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
9518
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7918
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
7082
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
5750
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...
1
4563
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3188
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.