473,889 Members | 2,031 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 10392
Richard posted:
Frederick Gotham <fg*******@SPAM .comwrites:
>Richard posted:
>>> for(size_t i = len - 1; i != -1; --i)
>>Its not cryptic : it just plain sucks and may well be inefficient too.


Care to express why you think it "plain sucks", and why it may be well
be
>inefficient too?

Sure : I'm just expressing my individuality and unsupported opinion as
you like to do :-; And it was explained to you on c++ forum.

There's a difference between an "explanatio n", and "this his how I do it --
any other way is wrong".

It is much more common, and often faster, to a zero check as the
limiting condition. Maybe the compiler will do it for you. I dont know.

while(count--)
arr[count]=val;

But if a loop is more complex, it's nice to shape it as a "for" loop with
four straight-forward compartments:

1) The stuff done before the loop begins.
2) The condition which is tested.
3) The loop body which is executed.
4) The stuff done after each iteration.

--

Frederick Gotham
Aug 9 '06 #171
Richard posted:
Would you be able to read the code as well if someone stripped out all
the whitespace?

Yes, although I'd appreciate if you'd leave the new-line characters in.

I've seen plenty of programmers who write the likes of the following
(including an ex-lecturer of mine:)

int i=width*2+4/height*3/2;

I've no problem reading it, even though I'd prefer something like:

int i = width*2 + 4/height * 3/2;

--

Frederick Gotham
Aug 9 '06 #172
Ian Collins wrote:
ena8t8si wrote:
>Having said that, the reigning culture in comp.lang.c
is to remind contributors about what's considered
topical, and especially what isn't.

I don't see you jumping on anyone who advocates the development strategy
of using a debugger to work out why something doesn't work. If I were
to dare to suggest they write some tests, I'm sure you'd pile in and
accuse me of proselytising.

Topicality is in the eye of the beholder.
Enforcing topicality helps a newsgroup grow a crew of regulars, without
boring them with endless questions like, "How do I click on the VC++ Class
Wizard?"

A crew of regulars may then shepherd discussions that link the newsgroup's
topic to issues of interest to all programmers. The difference is the
discussion participants know the difference between topical and marginal
items.

In this system, nobody scores points by saying "your post is off-topic
because it mentioned C and also Brand X". Such grumpiness does not reflect
well on the accusers.

And a newsgroup can only grow when its senior members bring good general
advice.

(BTW my creds here are K&R C since the 1980s, folks...)

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Aug 9 '06 #173
en******@yahoo. com writes:
Ian Collins wrote:
>>
It may not be popular in these parts, but I'd recommend you become
familiar with Test Driven Development as a way of enhancing the quality
of your code, both in design and implementation.

Kindly take your TDD proselytizing to a newsgroup where
it's topical.
Its called a developing thread.
Aug 9 '06 #174
Frederick Gotham <fg*******@SPAM .comwrites:
Richard posted:
>Frederick Gotham <fg*******@SPAM .comwrites:
>>Richard posted:

for(size_t i = len - 1; i != -1; --i)

Its not cryptic : it just plain sucks and may well be inefficient too.
Care to express why you think it "plain sucks", and why it may be well
be
>>inefficient too?

Sure : I'm just expressing my individuality and unsupported opinion as
you like to do :-; And it was explained to you on c++ forum.


There's a difference between an "explanatio n", and "this his how I do it --
any other way is wrong".

>It is much more common, and often faster, to a zero check as the
limiting condition. Maybe the compiler will do it for you. I dont know.

while(count--)
arr[count]=val;


But if a loop is more complex, it's nice to shape it as a "for" loop with
four straight-forward compartments:

1) The stuff done before the loop begins.
2) The condition which is tested.
3) The loop body which is executed.
4) The stuff done after each iteration.
It was an example of the range. I know how a for loop works.
Aug 9 '06 #175
"Phlip" <ph******@yahoo .comwrites:
Ian Collins wrote:
>ena8t8si wrote:
>>Having said that, the reigning culture in comp.lang.c
is to remind contributors about what's considered
topical, and especially what isn't.

I don't see you jumping on anyone who advocates the development strategy
of using a debugger to work out why something doesn't work. If I were
to dare to suggest they write some tests, I'm sure you'd pile in and
accuse me of proselytising.

Topicality is in the eye of the beholder.

Enforcing topicality helps a newsgroup grow a crew of regulars, without
boring them with endless questions like, "How do I click on the VC++ Class
Wizard?"
But like the post you criticised, this is OT. Take it to alt.pedant or
somesuch.

Alteratively, carry on since its a *developing thread* and others not
interested can kill the thread. Easy eh?

Too many chiefs too few indians 'round these parts.
Aug 9 '06 #176
"Frederick Gotham" <fg*******@SPAM .comwrote in message
news:hy******** ***********@new s.indigo.ie...
Philip Potter posted:
I can see exactly why you and Keith keep disagreeing in this respect.
You are saying that the code has exactly the same information as before,
so any programmer worth his salt would be able to work out what the
declaration meant, whatever the word order.


Precisely.

Consider an internal linkage, inline function which returns a const
pointer
to a const int. Each of the following are easily readable to me:

inline static const int * const Func1(void) {}

static inline int const* const Func2() {}

const static int inline *const Func3(void) {}

int const inline static* const Func4() {}
Good for you if you can read it. I have no objection to Func1 or Func2,
except that Func2 is poor-style C89 (it doesn't specify arguments).

Func3 and Func4 are less readable to me. The return type is "const int *
const" or "int const * const" and yet these terms have been scattered
throughout the declaration. The function itself is declared "static inline"
or "inline static". Why mix these things up? Don't you think it makes more
sense to write:

<function-modifiers<retur n typeFunc();

than anything else? Any other ordering will intermingle keywords specifying
return type with keywords that have nothing to do with return type.
And you're right. It certainly is still just as possible to get the same
information.

However, the same programmer, when presented with a word order he is not
familiar with, will take longer to read it, and will have to think more,
and (quite possibly) will be frustrated by this fact. The code is not
unreadable; but it *is* less readable.


I don't quite agree. The only time I need to pay attention to word order
in a >
C definition is whether a "const" is placed before or after an asterisk:

int const *p;
int *const p;

Other than that, I just scan the words and take meaning from them.
Again, good for you. But I want my code to be portable to picky programmers.

--

Philip Potter

Aug 9 '06 #177
On Wed, 09 Aug 2006 17:19:35 +0200, Richard <rg****@gmail.c omwrote:
>en******@yahoo .com writes:
>Ian Collins wrote:
>>>
It may not be popular in these parts, but I'd recommend you become
familiar with Test Driven Development as a way of enhancing the quality
of your code, both in design and implementation.

Kindly take your TDD proselytizing to a newsgroup where
it's topical.

Its called a developing thread.
A new buzzword? I call it a thread that's become off-topic, and should
be ended or moved to an appropriate venue.

--
Al Balmer
Sun City, AZ
Aug 9 '06 #178
Phlip said:
Richard Heathfield wrote:
>Phlip in c.p has made himself a right PITN by going on and on and on
about TDD. Please don't make the same mistake. The clc group is about the
C language, not about development strategies.

This is a new low for you, Richard - invoking my name to flame someone
else.
I wasn't flaming him. I was asking him not to dump loads of TDD evangelism
on us. Since you're here, perhaps I could ask you the same. Thanks.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Aug 9 '06 #179
On Wed, 09 Aug 2006 07:22:32 +0000, Richard Heathfield
<in*****@invali d.invalidwrote:
>Flash Gordon said:
>Frederick Gotham wrote:

<snip>
>>Posting here, and over on comp.lang.c++, I am disconcerted by the ever-
frequent mention of business.

Many of us here earn our living writing software.

Many of us here use third-party libraries written in C. That does not mean
that third-party libraries are topical in clc.
No one is actually discussing business. What does happen is that in
the course of discussion, people draw from their real-world experience
for purposes of exposition. If programming style is topical, surely
programming style in the context of the real world is topical. You
can't discuss the merits of a style without giving reasons for it. For
most of us professionals, the reasons relate to real-world
considerations such as maintainability and working with other
programmers. For Frederick, the reasons appear to be that he enjoys
flouting convention, and likes to make up stuff as he goes along.
That's OK, he's a hobbyist, and need only please himself. However, he
should make an effort to understand that professional programmers have
other goals and other criteria, and not too surprisingly, those goals
and criteria relate to their jobs.

--
Al Balmer
Sun City, AZ
Aug 9 '06 #180

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
9970
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
9810
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,...
0
10794
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10896
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
10443
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9612
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...
0
7153
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
6031
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4652
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

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.