472,328 Members | 1,728 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 software developers and data experts.

Writing portable code...

There are some people here (let's call them "regulars" for short)
that are always giving lessons to people about how easy is to
write portable code, etc. They always point fingers at you telling you
how bad you write code.

One of them (I would say the prototype of them) is Heathfield.

Here is an exchange that happened just a few hours ago, that
demonstrates my point:

WRITING CODE IS HARD. And regulars aren't better at it than everybody
else...

Ed Jensen wrote
There are very few regulars here in comp.lang.c that'll admit that
writing 100% portable C code is non-trivial.
Then, Heathfield answered:
I'm one of them, however.
I think it's easy to write *very* portable code, but difficult to write
100% portable code. Consider, for example, this simple program:
[code snipped]

Harald van Dijk answered:
>I can see one very obvious bug: you're using a file after closing it.
That's not the way you should be writing code even if it's not meant
to be portable.
And Heathfield had to acknowledge...
Oh, stupid stupid stupid (me, not you). You're right, of course. That
was unintentional, by the way!
>
Sep 2 '07 #1
7 1768
On Sun, 02 Sep 2007 10:52:51 +0200, jacob navia wrote:
There are some people here (let's call them "regulars" for short)
that are always giving lessons to people about how easy is to
write portable code, etc. They always point fingers at you telling you
how bad you write code.

One of them (I would say the prototype of them) is Heathfield.

Here is an exchange that happened just a few hours ago, that
demonstrates my point:

WRITING CODE IS HARD. And regulars aren't better at it than everybody
else...
If you mean that regulars are human, they are, but your statement
with its verbatim meaning is only true for sufficiently small
values of "everybody else" <flame>(e.g. you shouldn't be included
in it)</flame>.
Ed Jensen wrote
There are very few regulars here in comp.lang.c that'll admit that
writing 100% portable C code is non-trivial.

Then, Heathfield answered:
I'm one of them, however.
I think it's easy to write *very* portable code, but difficult to write
100% portable code. Consider, for example, this simple program:

[code snipped]

Harald van Dijk answered:
>I can see one very obvious bug: you're using a file after closing it.
>That's not the way you should be writing code even if it's not meant
>to be portable.
>

And Heathfield had to acknowledge...
Oh, stupid stupid stupid (me, not you). You're right, of course. That
was unintentional, by the way!
>
If someone has anything to say about that, they'll answer on that
thread. And your question about C was?
--
Army1987 (Replace "NOSPAM" with "email")
No-one ever won a game by resigning. -- S. Tartakower

Sep 2 '07 #2

"Army1987" <ar******@NOSPAM.itwrote in message
news:pa****************************@NOSPAM.it...
On Sun, 02 Sep 2007 10:52:51 +0200, jacob navia wrote:
>WRITING CODE IS HARD. And regulars aren't better at it than
everybody else...

If you mean that regulars are human, they are, but your statement
with its verbatim meaning is only true for sufficiently small
values of "everybody else" <flame>(e.g. you shouldn't be included
in it)</flame>.
A C compiler is quite a difficult piece of software to write. I planned to
write one as a followup to MiniBasic, but shrank from the challenge.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Sep 2 '07 #3
jacob navia <ja***@jacob.remcomp.frwrites:
There are some people here (let's call them "regulars" for short)
that are always giving lessons to people about how easy is to
write portable code, etc. They always point fingers at you telling you
how bad you write code.

One of them (I would say the prototype of them) is Heathfield.

Here is an exchange that happened just a few hours ago, that
demonstrates my point:

WRITING CODE IS HARD. And regulars aren't better at it than everybody
else...

Ed Jensen wrote
>There are very few regulars here in comp.lang.c that'll admit that
writing 100% portable C code is non-trivial.

Then, Heathfield answered:
>I'm one of them, however.
I think it's easy to write *very* portable code, but difficult to write
100% portable code. Consider, for example, this simple program:

[code snipped]

Harald van Dijk answered:
>>I can see one very obvious bug: you're using a file after closing it.
That's not the way you should be writing code even if it's not meant
to be portable.

And Heathfield had to acknowledge...
>Oh, stupid stupid stupid (me, not you). You're right, of
course. That
was unintentional, by the way!
>>
Was it? Wow. If all of us neglected to make the unintentional mistakes I
fee sure the standards of our code would greatly improve.....

Sep 2 '07 #4
Malcolm McLean wrote:
>
"Army1987" <ar******@NOSPAM.itwrote in message
news:pa****************************@NOSPAM.it...
>On Sun, 02 Sep 2007 10:52:51 +0200, jacob navia wrote:
>>WRITING CODE IS HARD. And regulars aren't better at it than
everybody else...

If you mean that regulars are human, they are, but your statement
with its verbatim meaning is only true for sufficiently small
values of "everybody else" <flame>(e.g. you shouldn't be included
in it)</flame>.
A C compiler is quite a difficult piece of software to write. I planned to
write one as a followup to MiniBasic, but shrank from the challenge.
Indeed. However jacob has, to my knowledge, written only the machine code
generating and optimising portions of lcc-win32. The front-end is mostly
lcc. But I'm not deprecating his efforts.

Sep 2 '07 #5
jacob navia wrote:
There are some people here (let's call them "regulars" for short)
that are always giving lessons to people about how easy is to
write portable code, etc. They always point fingers at you telling you
how bad you write code.

One of them (I would say the prototype of them) is Heathfield.

If I post code, I like to get it corrected. Don't you?

Sometimes, the mistakes are rather uninteresting, typos that would be
detected by a compiler anyway, but in other cases the experts do teach
me something new.

Regulars that post solid code, are a great asset, "anybody" can post a
quote from the standard.
My PB for a clean compile in C, is ca a 1600 liner... that don't mean it
was bug-free.

--
Tor <torust [at] online [dot] no>
Sep 2 '07 #6
On Sep 2, 9:52 am, jacob navia <ja...@jacob.remcomp.frwrote:
There are some people here (let's call them "regulars" for short)
that are always giving lessons to people about how easy is to
write portable code, etc. They always point fingers at you telling you
how bad you write code.

One of them (I would say the prototype of them) is Heathfield.
I wuda used a word something like apotheosis.

Here is an exchange that happened just a few hours ago, that
demonstrates my point:

WRITING CODE IS HARD. And regulars aren't better at it than everybody
else...

It's piss easy really.

Still preaching about your own incompetence.

Martin

Sep 3 '07 #7
On Sun, 02 Sep 2007 19:12:34 +0530, santosh wrote:
Malcolm McLean wrote:
>>
"Army1987" <ar******@NOSPAM.itwrote in message
news:pa****************************@NOSPAM.it.. .
>>On Sun, 02 Sep 2007 10:52:51 +0200, jacob navia wrote:

WRITING CODE IS HARD. And regulars aren't better at it than
everybody else...

If you mean that regulars are human, they are, but your statement
with its verbatim meaning is only true for sufficiently small
values of "everybody else" <flame>(e.g. you shouldn't be included
in it)</flame>.
A C compiler is quite a difficult piece of software to write. I planned to
write one as a followup to MiniBasic, but shrank from the challenge.

Indeed. However jacob has, to my knowledge, written only the machine code
generating and optimising portions of lcc-win32. The front-end is mostly
lcc. But I'm not deprecating his efforts.
Frankly, if the generation and optimization portions are any good, that'd
be quite a feat in and of itself.
Sep 3 '07 #8

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

Similar topics

4
by: aaronfude | last post by:
Hi, Perhaps this is slightly offtopic. Coming into the Windows world from Unix. Is there a reference on writing C++ libraries in a portable...
385
by: Xah Lee | last post by:
Jargons of Info Tech industry (A Love of Jargons) Xah Lee, 2002 Feb People in the computing field like to spur the use of spurious jargons....
10
by: Jason Curl | last post by:
Dear C group, I'm very interested in writing portable C, but I only have GNU, Sparc and Cygwin to compile on. What I find is the biggest...
6
by: Abubakar | last post by:
Hi, we are finding out ways in which we could develop libraries that could be written in c++ in a way that we can use them in windows, linux, and...
3
by: jitu.csewizard | last post by:
hi overview: function sprintf(<buffername>,<format string>, .....) in this function you need to allocate the size of buffername before hand. ...
5
by: Richard Giuly | last post by:
Hello, I would like to write "portable" C++ code that could theoretically run on linux, windows, and other platforms, and I'd like to use VS as...
6
by: shalakasan | last post by:
Hi, I want to open a binary file and write to a specific location in File. Here is how my code looks like: int main() { long lbuf = 0;...
30
by: mellyshum123 | last post by:
I'm wanting to write an int to a file, and so far I have written: const char buff; int num = 256 //for the sake of the example sprintf(buff,...
16
by: rahul | last post by:
void foo(void) { /* blah blah */ } char buf = {....}; memcpy( (void *)&foo, buf, sizeof buf); This thing is giving segmentation fault on...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.