C, really portable?

K

Keith Thompson

jacob navia said:
In general C programs port well, but serious improvements to
the portability of the language could be done if the
far too numerous "dark zones" (UB) would be correctly
specified.

Nailing down the details of those "dark zones" could also make the
language more difficult to implement on some platforms, hindering
portability.

C does place a heavier burden on the programmer than many other
languages. It assumes you know what you're doing, and often isn't
very helpful when that assumption turns out to be incorrect. This is
a deliberate decision, part of what's often referred to as the "spirit
of C".

It's perfectly reasonable to design a language similar to C, but with
better defined behavior on errors -- especially if you happen to have
your own compiler and a newsgroup in which to discuss it.

It's also perfectly reasonable to advocate changing C; comp.std.c is
the appropriate newsgroup for this. Being able to point to an
existing implementation is likely to help your case, especially if you
can demonstrate that a feature can be implemented on a wide variety of
platforms.
 
M

Mark McIntyre

Keith Thompson a écrit :

This is my point. The error analysis of printf is not portable.

No, no no. Are you dense? AS SPECIFIED, its completely portable. Any
zero or greater value means success. Any negative value means failure.
This is completely portable.

To be sure, more detailed analysis is not portable. I should imagine
this is why it was excluded from the standard, wouldn't you?


Please understand that I am NOT arguing against portability
but pointing to the fact that even in the most simple
programs, standard C leaves an essential part of
software construction: error analysis, completely out
of the picture!

Only if the programmer is bad.

I'm sorry, but really you asked for that.
 
M

Mark McIntyre

Mark McIntyre a écrit :

(actually websnarf wrote this tripe)

I didn't make the original remark. If you /must/ reply to a deeply
nested comment, please get the immediate attributions rght. I don't
want anyone who can't read chevrons to think I wrote that patent
nonsense.
Excuse me but maybe you know that VB 6 is no longer
supported by Microsoft and you are supposed to rewrite
your software into VB .NET now.

This has been a catastrophe for many small software

I totally agree with you. Anyone saying that VB is portable is a fool
or a knave.
 
M

Mark McIntyre

Well, of course the language is very portable. But when you
dig a bit deeper you find that things like error failure modes
and error analysis is completely left out of the picture or
treated as an afterthought. ("An error occured")

My point is that this is a flaw that hinders the portability
of C, even in small programs like the example I gave.

For goodness' sake, no it does NOT. It hinders teh portability of a
programme that depends on platform-specificextensions to C, but no
more.

It in fact AIDS portability, since it prevents the use of non-portable
error codes.
Is this code snippet portable?

(snip example of potential integer overflow).
No, it is not, since the overflow behavior is not specified...

I disagree. Its portable, but requires care. YMMV.
In general C programs port well, but serious improvements to
the portability of the language could be done if the
far too numerous "dark zones" (UB) would be correctly
specified.

But they can't be, don't you understand? How would you specify the
above, on a chip which didn't support detection of integer overflow?
 
J

jacob navia

Mark McIntyre a écrit :
Of course its feasible, But many of them have no meaning and in fact
may even be impossible on many implementations.

Who cares? Those implementations are not FORCED to issue that
kind of errors!!!!

They have only to respect the ranges for the errors
they do issue.

The nice thing of such an implementation is that offers
portability at no cost for anybody.

Assigning a range of values for different types of
errors allows the calling program to check for in a
portable way the type of error (for instance i/o error)

r = fprintf(... );
if (r == EOF) {
printf("Disk full. Please erase some files\n");
}

But it DOESN'T constrain the implementations in any way.
It just constrains the range of error codes so that they can
be portably tested!

I mean, would you
really want to provide an "out of red ink" error code for a screen
device? Or a "please rewind the tape" error for a keyboard?

Those codes would be in some portable range, of values. That way
all those errors could be tested in a portable way without knowing
anything specific about the printer/output device, but
KEEEPING the possibility of a more specific error handling
if desired.

jacob
 
J

jacob navia

Mark McIntyre a écrit :
Only if the programmer is bad.

I'm sorry, but really you asked for that.

Please Mark suppose this program:

fprintf(outfile, ... etc);

Are you going to say to me that if fprintf fails,
this is the programmer's fault ???

No, it is that the disk is FULL, period.

What I am trying to say is that the programmer has no
PORTABLE way to test for that condition...

Normally you would ASSUME that if (r < 0) the disk
is full, but it could be actually completely another
thing: File opened for reading only, no access to the
device etc.

This kind of analysis is called ERROR ANALYSIS and it is
an essential part of software construction. And, by
the way, the good programmers are the ones that always
have this issues in mind.
 
J

jacob navia

Mark McIntyre a écrit :
But they can't be, don't you understand? How would you specify the
above, on a chip which didn't support detection of integer overflow?

Well what happens with the fesetenv, fegetenv and all floating point
environment functions in a machine that doesn't have floating point?

There could be always provisions that allow certain parts of the
standard to be optional!

But WHY do we have to use always the LOWEST common denominator???

MANY CPU support the overflow flag please.

jacob
 
J

jacob navia

Mark McIntyre a écrit :
(actually websnarf wrote this tripe)



I didn't make the original remark. If you /must/ reply to a deeply
nested comment, please get the immediate attributions rght. I don't
want anyone who can't read chevrons to think I wrote that patent
nonsense.

You are right. Excuse me.
 
W

websnarf

P.J. Plauger said:
No, but it's part of a complete breakfast. Portability is a
measure of the relative cost of moving software between
platforms vs. rewriting it;

Incorrect. If what you said was true then "portability cost" would be
a redundant phrase that had no meaning. Of course, that's not the
case. So you are attempting to claim that the definition of
"portability" is really the definition of "portability cost".

Portability describes a *CHARACTERISTIC* of the degree of
transportability of source code. By itself, its not a measure of cost.
[...] it's not a Boolean. Availability is thus an important factor in improving portability.

No. Availability affects where you can port to. The nature of a given
source code's portability is always taken against the set of platforms
that have a compiler for that platform.

One can see this more clearly when one realizes that Java was a
portable language *BEFORE* any compilers were available for it.
Because that's the nature of the language itself. Availability, just
provided proof.
[...] and many of them score nearly perfect on two or more
nontrivial validation suites. Put another way, I've sold C code
intended to be portable also for several decades and I've *never*
had to worry about whether that code will compile, and execute
correctly, on a multitude of platforms. (With C++, I *always*
worry.)

Before C came along, I was doing similar things with Fortran,
and with reasonable success.

Well yeah, and you could do the same thing with Visual Basic, and the
various Basic interpretors available for UNIXs, and so on.

Please don't translate my qualitative measure into a Boolean.
Turn your contrast knob down a bit. My point was that you could
achieve rather high portability using the Pfort subset of Fortran.

Right, but the same true of other languages including C, and is
actually not in support of your point.
(See Kernighan & Plauger, "Software Tools".) You could do not
quite as well with Pascal, even though that language was allegedly
more portable than Fortran. (See Kernighan & Plauger, "Software
Tools in Pascal".) But you can write *way* more powerful code
that's portable in C.

But you can write code far more powerful *still* in other languages,
like Perl, Python, Java, etc. C may compare very well to extremely
obsolete languages that are only in marginal use today, but I do
believe I said "modern languages in common use". You're caught in a
time warp here -- you've seen that C is more portable than Pascal, but
somehow cannot see that modern languages are again more portable than
C.
Your contrast knob is set too high again. The developer always
has *some* responsibility in writing portable code; the question
is what reward you get for your effort. I maintain that Standard
C has a pretty high reward for remarkably low effort,

Right, because performance doesn't matter to you, and things like
cryptography just have no meaning to you. And of course, for whatever
reason you are not actually comparing it to other contemporary
languages.
[...] particularly
given that C is such a powerful (read: low level) language. But
it's never a question of putting all the responsibility either
on the programmer or on the language. So to say that most
languages are portable is to once again treat portability as a
Boolean, when it's not.
If fact, did you know
its fact possible to be portable *BETWEEN* many languages? When you
put the onus onto the programmer, you can claim all sorts of
capabilities for your language.

No, you can claim all sorts of capabilities for the programmer.
But if you're rewriting the code, you've left the above
definition of portability in the dust.

I don't know what definition you are talking about, but I think you
missed my point. See: http://www.nyx.net/~gthompso/self_mult.htm
Only if you think in black and white. We informally say that
a language is portable if it lowers the cost of writing
programs that are portable (cheaper to move than to completely
rewrite).

Well no, *you* informally say that, because you have little respect for
precise language. Its a good thing you aren't on any committee that
manages a international standard. Oh wait ...

http://www.m-w.com/dictionary/portable
http://www.thefreedictionary.com/portable
http://dictionary.reference.com/search?q=portable

There's nothing about cost in any of those definitions. Also notice
that the definitions include the "two or more platforms" in them.
Meaning that "portability" is not related to the number of platforms
your code is portable, but rather the degree to which the software
itself is inherently portable.
[...] If you take too much pain in porting the code,
somewhere along the line the cost of a complete rewrite
proves to be lower and the code is "not portable". (You
sometimes find that out too late.)

Now tell me who's being black and white?
[...] And I've used about half a dozen
other popular languages with lesser success. So, IM(extensive)E
C portability is far from meaningless to me. YM(obviously)V.

In c.l.c we often see 'not portable' comments, but I wonder just how
portable C apps really are.

They're not. Amongst languages in common use today, C is just like
Visual Basic in that there just really isn't any real expectation of
portability on any real world application code. Nearly every other
language in common use today is far more portable than C.

Does your planet have an oxygen atomsphere? Just curious.

Well my planet has Lua, Java, Python, Perl, TCL, and bizarre new
languages like Haskel, Scheme, etc. They are all portable.

I wonder what language their compilers were written in. I'm
sure *some* of them were written in languages other than C.

I think all of them were. So let us see what happens when we follow
this to its logical conclusion. Since they were written in C,
presumably that makes C more portable than any one of them right? Ok,
but what language is C written in? When a platform is first
constructed, the pattern usually is that they make an assembler, which
is then used to bootstrap a small C compiler, after which a real C
compiler is ported to that, or something similar. So by this reasoning
we can conclude, then, that assembly is more portable than C.

Each of those languages was *painstakingly ported*. As posted by
Walter Robinson in this thread, apparently the Perl source code (which
is in C) is a horrendous mess to port to each platform. I.e., even
*after having been ported* its a pain in the ass to use, because of
platform compatibility problems. But these are not problems of the
Perl *language*, but rather the implementation, which of course, is
mostly related to poor portability of C itself.
 
W

websnarf

Mark said:
P.J. Plauger said:
Does your planet have an oxygen atomsphere? Just curious. [...]

Oh and BTW, my planet actually has mostly a Nitrogen atmosphere, though
it does includes a smaller proportion of oxygen, CO_2 and other
elements.

Sounds habitable. One sun or two? I'm guessing one, but its possible
its two, apparently habitable planets can form round binary systems.

Can you send me the plans for your FTL transmitter by the way, its
very effective.

Remind me. You're the one that said empty strings are illegal right?
 
P

P.J. Plauger

Incorrect. If what you said was true then "portability cost" would be
a redundant phrase that had no meaning. Of course, that's not the
case. So you are attempting to claim that the definition of
"portability" is really the definition of "portability cost".

Call it a claim if you will. I think of it as an observation.
If you reread your earlier diatribes, you'll find nearly as many
potential meanings for "portability" as occurrences of that word.
I'm simply coming from a coherent worldview that seems to fit
with what rational people seem to mean when they use that word.
I've been promulgating this "definition" for decades, and I've
repeatedly been told that it makes sense. You seem to be working
backwards from a syllogism that ends in "Ergo, C is not really
portable." As Adlai Stevenson famously summarized a political
opponent's argument, "These are the opinions on which I base my
facts."
Portability describes a *CHARACTERISTIC* of the degree of
transportability of source code. By itself, its not a measure of cost.

Fine, pick your adjective. But once you say "degree" you've given
up on using portability as a Boolean. (And what happens when your
boss tells you that one degree costs $12,873.17?)
[...] it's not a Boolean. Availability is thus an important factor in
improving portability.

No. Availability affects where you can port to. The nature of a given
source code's portability is always taken against the set of platforms
that have a compiler for that platform.

And the fewer the platforms, the higher the probable cost of
porting -- I mean, the lower the degree of portability.
One can see this more clearly when one realizes that Java was a
portable language *BEFORE* any compilers were available for it.
Because that's the nature of the language itself. Availability, just
provided proof.

Uh, no. My brother worked a couple of years at making Java programs
really portable. He began by throwing away all multithreading code
and simplifying all GUI calls, so that he could then focus on all
the really sneaky portability problems. FWIW, he's one of the best
programmers I know, and it wasn't easy work for him. (Gosling
began by eliminating all the things from C that he *knew* were
portability problems, thus freeing himself up to get in *real*
trouble.)
Right, but the same true of other languages including C, and is
actually not in support of your point.

Back to the complete breakfast again. That "characteristic" you
call portability has a number of components. Among them are
availability, uniformity, and power. C rates high on all these
measures, making it IME the best candidate in many cases for
writing code intended to be portable.
But you can write code far more powerful *still* in other languages,
like Perl, Python, Java, etc.

And that's where we part company. If by powerful you mean you can
perform certain large scale operations with an economy of expression,
then I agree. I write Maplesoft scripts to do things in minutes that
would be impractical in C. But if by powerful you mean that there
are few limitations on what you can manage, then C wins hands down.
I wouldn't program a coffee pot in Maplesoft, but I do perform
quite a bit of mathematics in C.
C may compare very well to extremely
obsolete languages that are only in marginal use today, but I do
believe I said "modern languages in common use". You're caught in a
time warp here -- you've seen that C is more portable than Pascal, but
somehow cannot see that modern languages are again more portable than
C.

I admit that I'm an old fart, but I'm also quite accustomed to being
declared obsolete on a regular basis. IIRC, the first time someone
told me my days as a programmer were numbered was in 1964. Then
there were the Pascal zealots, then Ada, then C++, then Java,
then...
Right, because performance doesn't matter to you, and things like
cryptography just have no meaning to you.

Where the hell did that come from? And who the hell are you to tell
me what matters to me or what has meaning to me? Get stuffed.
And of course, for whatever
reason you are not actually comparing it to other contemporary
languages.

Funny, I thought I was.
Well no, *you* informally say that, because you have little respect for
precise language. Its a good thing you aren't on any committee that
manages a international standard. Oh wait ...

You have now crossed the line from being simply irrational and
parochial into being actively insulting. I think this conversation
is nearing its end.
[...] If you take too much pain in porting the code,
somewhere along the line the cost of a complete rewrite
proves to be lower and the code is "not portable". (You
sometimes find that out too late.)

Now tell me who's being black and white?

If the cost is $17,000, that's a "degree". If the question is
"Is cost less than $17,000?" that's a Boolean. Black and white.
I think all of them were. So let us see what happens when we follow
this to its logical conclusion. Since they were written in C,
presumably that makes C more portable than any one of them right? Ok,
but what language is C written in?
C.

When a platform is first
constructed, the pattern usually is that they make an assembler, which
is then used to bootstrap a small C compiler, after which a real C
compiler is ported to that, or something similar.

No, you take an existing C compiler, written in C, and rewrite the
back end to make a cross compiler. You do the same with an assembler,
also written in C. Some of us have been doing that for a third of
a century. Truth to tell, I used to have to write about 100 lines
of assembly language to support each new machine architecture.
For the past decade or so, I even write that as non-portable C.
And these days you can write a self-compiling translator in C++
as well -- with a few thousand lines of C code under the hood.
I'll even confess that I once wrote a relocating linker as one
giant QED edit script, but I didn't do my employer any favors in
doing so. The fact is that C is still the only language that is
both portable and almost completely self supporting, OS and all.
C++ comes close, but whatever is third is way back there.
So by this reasoning
we can conclude, then, that assembly is more portable than C.

A syllogism stands or falls on the truth of its assumptions.
Each of those languages was *painstakingly ported*. As posted by
Walter Robinson in this thread, apparently the Perl source code (which
is in C) is a horrendous mess to port to each platform.

Shows what happens when you believe more in Perl than in C, I'd say.
I.e., even
*after having been ported* its a pain in the ass to use, because of
platform compatibility problems. But these are not problems of the
Perl *language*, but rather the implementation, which of course, is
mostly related to poor portability of C itself.

Hold onto that warm thought. Winter is coming.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
 
W

websnarf

P.J. Plauger said:
Call it a claim if you will. I think of it as an observation.

That's pretty slithery ...
If you reread your earlier diatribes, you'll find nearly as many
potential meanings for "portability" as occurrences of that word.

That would be pretty hard considering I've cited the dictionary
definition before as well.
I'm simply coming from a coherent worldview that seems to fit
with what rational people seem to mean when they use that word.

And you've come to the conclusion that C is a portable language out of
that. Some might say there's something wrong with your worldview.
I've been promulgating this "definition" for decades,

That's pretty sad ... Its like the swiftboat veterans who believe we
could have won in Vietnam if we had just stayed there.
[...] and I've repeatedly been told that it makes sense.

By who? Oh yes -- people in your worldview. People who think that C
is a portable language. Nice echo chamber.
[...] You seem to be working
backwards from a syllogism that ends in "Ergo, C is not really
portable." As Adlai Stevenson famously summarized a political
opponent's argument, "These are the opinions on which I base my
facts."

And what is your basis for saying this? You say you've read my
archived stuff. I've expanded on this before, and certainly you've
added nothing new here (except for the revelation that you seem to
think earth has an Oxygen atmosphere). So to be honest, I don't think
I've said much new here myself either -- its not a backwards-built
argument. I more liken my exposition here to Stevenson's presentation
before the UN on the issue of missiles.
Fine, pick your adjective. But once you say "degree" you've given
up on using portability as a Boolean. (And what happens when your
boss tells you that one degree costs $12,873.17?)

Its a matter of english -- that's what "--ability" means. I don't get
to "pick" anything; I am just describing what it is.
[...] it's not a Boolean. Availability is thus an important factor in
improving portability.

No. Availability affects where you can port to. The nature of a given
source code's portability is always taken against the set of platforms
that have a compiler for that platform.

And the fewer the platforms, the higher the probable cost of
porting -- I mean, the lower the degree of portability.

"cost of porting"? Why didn't you just say "the higher the probable
porting"? Oh yeah -- that wouldn't make sense. Because "porting" does
not mean "porting cost".
Uh, no. My brother worked a couple of years at making Java programs
really portable. He began by throwing away all multithreading code
and simplifying all GUI calls, so that he could then focus on all
the really sneaky portability problems. FWIW, he's one of the best
programmers I know, and it wasn't easy work for him. (Gosling
began by eliminating all the things from C that he *knew* were
portability problems, thus freeing himself up to get in *real*
trouble.)

And so, if your brother were trying to port C code that was
multithreaded and had GUI calls, do you think your brother would have
an easier time? Your point here seems really irrelevant. Its true
that race conditions are not portable and that Java has been going
through growing pains, but I seem to remember a time when C was hardly
in better shape ("far" and "near" anyone?) The main difference being
that Java appears to have long ago solved problems that C never has.
Back to the complete breakfast again. That "characteristic" you
call portability has a number of components. Among them are
availability, uniformity, and power.

No -- these are orthogonal concepts. The Hello world program is plenty
portable, but you wouldn't call it powerful. The fact that certain
platforms don't have C compilers, (affecting availability), doesn't
make the program itself non-portable.

Similarly, you can look at the source code for Berkeley Db. Its
definately very powerful, and its got pretty reasonable availability,
and the high level API is very uniform -- but just take a look at the
source code! Its pathetic! Hand ported to each and every platform
one at a time, with only the very highest level of API portability!
What does the mean? It means we *KNOW* it doesn't work on Itanium or
AMD64 platforms -- or at least we know it won't until it gets
painstakingly hand ported to those platforms. The upshot? BerkeleyDB
is inherently unportable, excepting for the fact that it has been
"ported by force" to a finite (though fairly large) number of
platforms.
[...] C rates high on all these measures, making it IME the best candidate in many
cases for writing code intended to be portable.

Nonsense. For anything except the most trivial code, you put real
effort into porting C code, and even when you do so, your best bet is
to stick with very conservative statements like "Its very portable, and
known to work on platforms X, Y, Z ..." when describing such
portability. The C specification covers non-2s complement, undefined
behavior on integer overflow, incorrect right shifting, etc but the
problem is that such platforms are barely available, so you can't test,
and so you can't be sure.
And that's where we part company. If by powerful you mean you can
perform certain large scale operations with an economy of expression,
then I agree.

No, I mean things like ftp servers (its in the built-in libraries in
Python), consistent numerics, run-time generated code, auto-serialized
data structures, threading, built-in array/string safety and memory
leak protection and so on.
[...] I write Maplesoft scripts to do things in minutes that
would be impractical in C. But if by powerful you mean that there
are few limitations on what you can manage, then C wins hands down.

Show me run-time generated code, autoserialized data structures or
coroutines in C.
Where the hell did that come from?

Painful experience. If you can't right shift deterministically, you've
lost performance. If you can't assume integer size, you've lost
performance. Standard cryptographic algorithms require exact scalar
integer size knowledge (have "at least" such and such many bits is not
helpful -- it needs to be exact), deterministic right shifting, no
integer overflow, and double-wide integer multiply. If you are forced
to emulate those operations (which the ANSI C standard requires, if you
are writing such code), your performance drops.
[...] And who the hell are you to tell
me what matters to me or what has meaning to me? Get stuffed.

If you try to implement high performance code, especially crypto, with
just standard C how do you expect to do so with "remarkably low
effort"? You'll end up giving up on one of those things.
Funny, I thought I was.

You see, a lot of people are using google to read usenet now. It means
people can literally check your statements with the click of the mouse.
You can't rely on the news servers expiring your articles in hopes
that nobody will check what you say. In posts leading up to this one,
you've mentioned Fortran and Pascal -- this is in a response to my
statements about "modern languages in common use".
[...] If you take too much pain in porting the code,
somewhere along the line the cost of a complete rewrite
proves to be lower and the code is "not portable". (You
sometimes find that out too late.)

Now tell me who's being black and white?

If the cost is $17,000, that's a "degree".

No, that's a *MEASURE*. Measures, like cost, can go to infinity (in
theory). Degrees, as it is meant here, basically is between 0% and
100% (between 0 and 360 if you are talking about a circle, but its the
same idea). Do you see the difference?
If the question is
"Is cost less than $17,000?" that's a Boolean. Black and white.

Ok, but you miss my point. Why is it ok for *you* to synthesize an
arbitrary black and white, but when I just cite a commonly accepted
black and white (source code being portable or not), you get to deride
me for it?
Shows what happens when you believe more in Perl than in C, I'd say.

But the problems, in the case, *came* from C, the language it was
implemented in. Once its up and running, presumably, he'll have the
portable Perl language ready for him to use.
 
R

Richard Heathfield

P.J. Plauger said:
Get stuffed.

I commend this imperative to the attention of those ladies and gentlemen of
comp.lang.c who have hungry sigmonsters.
 
W

Walter Roberson

Each of those languages was *painstakingly ported*. As posted by
Walter Robinson in this thread,

That's "Roberson", by the way.
apparently the Perl source code (which
is in C) is a horrendous mess to port to each platform. I.e., even
*after having been ported* its a pain in the ass to use, because of
platform compatibility problems. But these are not problems of the
Perl *language*, but rather the implementation, which of course, is
mostly related to poor portability of C itself.

"Perl" is the language, "perl" is the implementation. The two are very
closely related: in the corner cases, when you start to get messy or
undefined behaviour, then the language is -defined- by the
implementation. And I don't mean that as sarcasm: that's the official
word from Larry Wall. Because of this, the official discussions in
comp.lang.perl [which make the ones here look very tame] nearly always
refer to "perl" (i.e., that which happens in some particular
implementation revision) instead of to "Perl".

Perl as a -language- includes a number of hooks to operating
system facilities, such as signals, fifos, pipes, subprocesses, sockets,
semaphores, and threads. These are, of course, non-portable,
so the conditional compiles and whatnot for each platform do the
best they can. If a particular platform cannot handle something,
then there is no question raised as to whether it is "compliant"
or not, because Perl (the language) for that platform is -defined-
by what perl (the implementation) is able to handle.

The documentation (for any particular implementation version and hence
lower-case perl) are full of references to Unix and Posix.


To take a random example: perl 5.8.4 for plan9 does not support

chown, chroot, dbmclose, dbmopen, endnetent, endprotoent,
endservent, getnetbyaddr, getnetbyname, getnetent, getprotoent,
getservent, getsockopt, sethostent, setnetent, setprotoent,
setservent, setsockopt, umask

each of which is a part of basic perl 5.8.4, documented on the
primary "perlfunc" documentation page (as opposed to, for example,
the "perlipc" documentation page, which some might attempt to
claim to be less normative than "perlfunc".)


But it isn't just a case of, "Well, if you manage to get perl
properly installed, then your programs will be portable!"
There is a repository, known as CPAN, which is not part of the
language itself, but has a lot of extension modules that are widely
used. A fair number of those modules require a C compiler to
install (often, but not always, for performance reasons), but
a fair number do not and are written in "pure perl". In my
experience, if a CPAN module will not install for me, there is
about a 75% chance that it relies on C, but there is about a 25%
chance that it is written in "pure perl"... and fails to build
or fails its self-test anyways.


perl does offer some features such as the ability to write a binary
big-endian (network byte order) long of -exactly- 32 bits ... but
perl doesn't define what happens if your native long size is
something different. Some of the conversions are defined in terms
of "bytes", but there is no word about what happens if you
are in the middle of a byte because you asked to do manipulations
on exactly 32 bits. And perl doesn't even try to offer a portable
floating point format, nor any tools or constants with which one could
probe to find out what the current floating point format looks like.


So... if you want to talk portability, Perl is definitely not
your poster child.
 
M

Malcolm

Richard Heathfield said:
P.J. Plauger said:


I commend this imperative to the attention of those ladies and gentlemen
of
comp.lang.c who have hungry sigmonsters.
websnarf (Paul Hsei)

The famous Mr Plauger
Where the hell did that come from? And who the hell are you to tell
me what matters to me or what has meaning to me? Get stuffed.
Authors of C textbooks are valauble people on the ng, and shouldn't be
insulted, wouldn't you agree?
 
W

Walter Roberson

Painful experience. If you can't right shift deterministically, you've
lost performance. If you can't assume integer size, you've lost
performance. Standard cryptographic algorithms require exact scalar
integer size knowledge (have "at least" such and such many bits is not
helpful -- it needs to be exact), deterministic right shifting, no
integer overflow, and double-wide integer multiply. If you are forced
to emulate those operations (which the ANSI C standard requires, if you
are writing such code), your performance drops.

The perl you were praising earlier uses integers that are
"at least such and such many bits.". There is only a very small
number of functions ("pack" and "unpack") that operate on integers
of exact sizes.
 
M

Mark McIntyre

Are you going to say to me that if fprintf fails,
this is the programmer's fault ???

Yes. If the programmer doesn't defend against common errors, its his
fault.
No, it is that the disk is FULL, period.

So? Thats not the programmer's fault, but not detecting that a write
error occured /is/.

I've said all I intend to in this thread, unless I see something
totally outrageous.
 
M

Mark McIntyre

There could be always provisions that allow certain parts of the
standard to be optional!

There's already quite a lot thats conditional on the implementation
being able to support it, such as the entire IO library, the maths
library, and so on. I can think of no reason to further bloat an
already massive document with a zillion pages entitled" this bit only
applies if you're using Zarniwhoot C 3.6 on a MicroBeeble 5 with Snork
2.4 or lower OS".
But WHY do we have to use always the LOWEST common denominator???

We're very very far from the LCD. Again your lack of experience
outside intel seems to mislead you.
MANY CPU support the overflow flag please.

And many many don't.
 
M

Mark McIntyre

Remind me. You're the one that said empty strings are illegal right?

No, I'm the one that said they made no sense to me. Feel free to
twist my words to your advantage though, I've no more use for them
once they've been pawed by trolls.
 

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,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top