473,854 Members | 1,486 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 10370
Philip Potter posted:
"Frederick Gotham" <fg*******@SPAM .comwrote in message
news:Ch******** ***********@new s.indigo.ie...
>Philip Potter posted:
I think that is exactly as clear as:

export template<class NumT, class StrT>
static inline
const typename Assum<NumT,StrT >::CharT *
Assum<NumT,StrT >::TextProcess( const Letters<NumT&st ls)

Yes but things get fuzzy when I return a pointer to an array:

export template<class NumT, class StrT>
static inline
const typename Assum<NumT,StrT >::CharT (*
Assum<NumT,Str T>::TextProcess (const Letters<NumT&st ls))[5]

And again, your style doesn't make it any clearer.
I would write it as:

export template<class NumT,class StrT>
typename Assum<NumT,StrT >::CharT const
static inline
(*Assum<NumT,St rT>::TextProces s(Letters<NumTc onst &stls))[5]
And I do find it clearer. Anyhow, I think this conversations has gone on
long enough.

--

Frederick Gotham
Aug 10 '06 #231
Al Balmer said:
On Thu, 10 Aug 2006 04:57:47 +0000, Richard Heathfield
<in*****@invali d.invalidwrote:
>>Dik T. Winter said:
>>In article <87************ @mail.comRichar d <rg****@gmail.c omwrites:
...
And what you think has no relevance in the real world : MOST european
based languages are adjective noun order.

*Germanic* european based languages. (I do not know about the Slavic
languages.)

In Polish, which is of course a Slavic language, it varies (just as it
does in English proper!).

For example: in "otwartym terenie" - "open terrain" - the adjective comes
first, and this is commonplace. But "dzien otwarty" - "open day" - places
the adjective after the noun.

But, to the point, the usage is conventional and normally doesn't
change, right?
Um, quite so. Polish is astonishingly regular for a natural language. And
whilst there may be exceptions to this rule that I don't know about, it
appears to have 100% regular spelling, too. For example, two of my Polish
friends rejoice in the name "Joanna", and each pronounces /both/ of the 'n'
letters - "Yo-a-nuh-na".
In English, we allow "poetic license" but normally
conventions are followed, even if not all conventions are consistent
with each other.
Yes. When a good writer breaks those conventions, he or she does so for a
good reason. For example, there's a book by Joseph Conrad that starts
something like this:

"And the wind blew. And the sea roared."

He doesn't mess around with merely starting a sentence with a conjunction -
he starts the entire /book/ with a conjunction! The effect, however, is
startling, and deliberately so.

I think there's a C newsgroup around here somewhere. Does anyone know where
it's got to?

--
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 10 '06 #232
Frederick Gotham <fg*******@SPAM .comwrites:
Philip Potter posted:
>>If you're expecting someone to say:

a big, yellow, smooth, painted wall

and instead, they say:

a smooth, yellow, painted, big wall

, then will you be confused, and will it take you longer to decipher
the sentence?

False comparison. In the above case, each specifier of "wall" is of an
equivalent type - an adjective. In declarations, there are some
specifiers which describe the function, and some which describe its
return value. Mixing them together doesn't confuse the compiler, but it
serves no purpose towards making it any clearer for people.

These are concepts in your own mind, not in the C language.
They're also concepts in the minds of most C programmers, based on the
way most C code is actually written. The same is true of indentation.
The compiler doesn't care how or whether you indent your code, but
anyone reading it does.
A function is defined just like a variable, except that you have
parentheses after the name which contain a list of arguments.

Here's a few things which a variable can be:

unsigned
volatile
static

Just like my "smoot, yellow, painted, big wall", I don't care what order
they're put in:
If you don't care, why not just do it the way everyone else does it?

--
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 10 '06 #233
Frederick Gotham <fg*******@SPAM .comwrites:
Chris Dollin posted:
>>It either runs fast and without crashing, or it doesn't.

It's either maintainable or it isn't.

My code is maintainable. Most of it is self-explanatory, and in other places
it's commented.
>But it /isn't/. And the proof is, it's not being accepted.

By whom? You?
By anybody in this discussion other than you. Or hadn't you noticed?
I think this conversation is getting a bit fruitless.

At the end of the day, the word order in a definition doesn't matter --
people should realise that and acquiesce to it.
Word order, in some cases, doesn't matter to the compiler. This has
been acknowledged *repeatedly* in this thread.

Arbitrary variations in word order, even if they don't matter to the
compiler, can make code more difficult to read for most people. Al
Balmer posted an excellent analysis of this phenomenon:

| One point that no one has brought up is that reading code in quantity
| is like reading English. One does not read one word at a time and
| think about what the combination of words means. We recognize phrases
| and even multi-line conventional idioms. When those conventional
| phrases are scrambled, we have to go back to word at a time reading
| and interpreting, at least momentarily. This not only slows the scan,
| but interrupts the flow of thinking and absorbing the meaning of the
| code.

It is your stubborn refusal to acknowledge this point that has made
this thread as long as it is.

If you want to use some unconventional style in your own code, code
that you never share with anyone else, nobody is going to complain.
If you insist on sharing your ideas with others, as you're doing here,
people are going to explain to you why it's a bad idea, as you've seen
here.

Nobody is going to acquiesce to your style. You should acquiesce to
that.

--
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 10 '06 #234

Richard wrote:
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.
The point is that threads not related to standard C
should develop somewhere else.

Aug 10 '06 #235

Philip Potter wrote:
"Frederick Gotham" <fg*******@SPAM .comwrote in message
news:vy******** ***********@new s.indigo.ie...
No, I prefer:

<type<type specifiers<cons t<volatile<stat ic/extern<inline>
<name>

const and volatile *are* type specifiers, afaicr.
Type qualifiers.

Aug 10 '06 #236

Frederick Gotham wrote:
>
I'm not trying to convice people to start writing:

int const static *Func(void);

But rather to explain to them that it's a perfectly acceptable variant.
It is perfectly acceptable to you. For
lots of other people, it isn't. Do you
get it now?

Aug 10 '06 #237
Keith Thompson <ks***@mib.orgw rote:
Frederick Gotham <fg*******@SPAM .comwrites:
Chris Dollin posted:
>It either runs fast and without crashing, or it doesn't.

It's either maintainable or it isn't.
My code is maintainable. Most of it is self-explanatory, and in other places
it's commented.
But it /isn't/. And the proof is, it's not being accepted.
By whom? You?

By anybody in this discussion other than you. Or hadn't you noticed?
Dunno about you, but I'd not noticed that, no.

Richard
Aug 11 '06 #238
"Philip Potter" <ph***********@ xilinx.comwrote :
"Richard Bos" <rl*@hoekstra-uitgeverij.nlwr ote in message
news:44******** *******@news.xs 4all.nl...
const static int inline *const Func3(void) {}

int const inline static* const Func4() {}
<snip>
>
Func3 and Func4 are less readable to me.
And yet, you will encounter all of them, and worse, in the wild. You may
not like them, but you'll have to be able to work with them.

Yes, I agree. What's your point? Func3 and Func4 are still less readable.
Wrong. You had it right last time: they're less readable _to you_. To
someone else, who wrote those lines, they're presumably more readable.

And my point? My point was that you're going to encounter a whole lot
worse than Frederick's unusual, but at least consistent style, so if you
get fazed by that kind of word order, you need more experience.

Richard
Aug 11 '06 #239
Keith Thompson <ks***@mib.orgw rote:
Frederick Gotham <fg*******@SPAM .comwrites:
Here's a few things which a variable can be:

unsigned
volatile
static

Just like my "smoot, yellow, painted, big wall", I don't care what order
they're put in:

If you don't care, why not just do it the way everyone else does it?
Who is this mythical "everyone" you keep harping on about? The
"everyone" who always uses the same style as "everyone" else? The one,
golden, omnipotent, omnipresent, sacrosanct C style?

If you read code that does not come from your own shop, you _are_ going
to encounter different styles of coding. Many of them are a lot less
consistent than Frederick's. And contrary to the assertions made in this
thread, it is not unfamiliarity which makes code hard to read - not for
longer than five minutes - it is inconsistency. I can easily read any
reasonably laid-out code, even if it's different from mine. The problems
start when a coder starts mixing styles at random.

Richard
Aug 11 '06 #240

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,...
0
11031
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
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,...
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
5942
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
2
4159
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.