473,838 Members | 1,624 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 10351
Richard wrote:
Convinced am I troll you are. Noone could be so ridiculously naive to
believe that the ordering doesnt affect people ability to read and
maintain your code.
I am much smarter than you, so you obviously can't read my code. This is
your problem, not my codes'!

;-)

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Aug 10 '06 #221
Richard wrote:
Convinced am I troll you are.

You left out the indefinite article: "a".

Noone could be so ridiculously naive to believe that the ordering doesnt
affect people ability to read and maintain your code.

Naive... or realistic? If people are taking any meaning from the word order,
then they're wrong to do so.

If I write:

int const *p;

, then does it mean that I'm lonely?

And if I write:

cont int *p;

, the does it mean that I'm excited?

--

Frederick Gotham
Aug 10 '06 #222
"Frederick Gotham" <fg*******@SPAM .comwrote in message
news:Bu******** ***********@new s.indigo.ie...
Philip Potter posted:
Yes -- I consider the asterisk to be a part of the name; this is reflected
by:

int *p, q, *r;

int (*k)[5];
I consider the asterisk to be part of the type. This is reflected by pointer
typecasts. (I admit that this view is not any more or less valid than
yours.)

I also wouldn't write

int *p, q, *r;

not because I find it difficult to read, but I'm afraid somebody else might.
(But this is very much IMHO, and you can do what you like.)
I started it when I had to deal with very long function definitions in
C++,
for example:

export template<class NumT, class StrT>
typename Assum<NumT,StrT >::CharT const
static inline
*Assum<NumT,Str T>::TextProcess (Letters<NumTco nst &stls)
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)

What is clear to you is not necessarily clear to others. Especially when
others have been used to a particular style for a long time.

Philip

Aug 10 '06 #223
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,StrT >::TextProcess( const Letters<NumT&st ls))[5]

--

Frederick Gotham
Aug 10 '06 #224
Frederick Gotham wrote:
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.
By /you/ to /your/ standards - just like /fast/, it's a
particular taste. So long as you're feeding yourself,
that's OK.
>But it /isn't/. And the proof is, it's not being accepted.

By whom? You?
By the people in the discussion who you are failing to convince.
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.
See? You're doing it /again/. You're saying that because the
word order doesn't matter /to the formal language processor/,
it doesn't matter. It matters to the /people/ involved.
(This is as true of English as it is of C declarations,
incidentally.) You should just realise that and acquiesce to it.

--
Chris "seeker" Dollin
"No-one here is exactly what he appears." G'kar, /Babylon 5/

Aug 10 '06 #225
On Thu, 10 Aug 2006 15:03:14 +0100, Chris Dollin <ch**********@h p.com>
wrote:
>"The grammar allows it" isn't enough. The grammar [including the lexis]
allows `int djh908gf( void *ewjh8455534 );` too, and `int *a, b;`,
and unrestrained use of `goto`, and redundant `auto`s and irrelevant
`register`s and pointless casts. The point about a widely-used ordering
for the formally order-irrelevant parts of a declaration means that
we don't have to /care/.
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.

In practice, over many years, conventions have appeared which make
this process possible. There are variations, but few, and they are
well known. Although I have a preferred brace style, I can switch
gears to one of the other conventional styles easily, so long as
there's consistency (the reason that maintenance programmers try to
maintain the style of the code they're changing.) OTOH, if you decided
that all opening braces should be in column 80 and all closing braces
should be indented from the previous statement, that's not one of the
conventions we're used to, and most of us would slow *way* down while
reading it, even though the compiler wouldn't mind a bit.

(Incidentally, although Frederick may be an expert cook, I suspect
he'd have some surprises in store if he took on the job of a real
chef.)

--
Al Balmer
Sun City, AZ
Aug 10 '06 #226
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? In English, we allow "poetic license" but normally
conventions are followed, even if not all conventions are consistent
with each other.

--
Al Balmer
Sun City, AZ
Aug 10 '06 #227
On Thu, 10 Aug 2006 13:26:57 GMT, Frederick Gotham
<fg*******@SPAM .comwrote:
>Yes -- I consider the asterisk to be a part of the name;
But, of course, it isn't.
>this is reflected
by:

int *p, q, *r;
Heh. You don't code for a living, but I had a long-term client who
insisted that the asterisk was part of the type and required

int* p;
int q;
int* r;

This, of course, would limit your choices of where to put other
modifiers.

I though it was silly, but it's not that unusual, and can be
considered one of the standard styles. I made my opinion known (about
this and even sillier things in their style guide), but it was
opinion, not religion, and they paid well.

--
Al Balmer
Sun City, AZ
Aug 10 '06 #228
"Frederick Gotham" <fg*******@SPAM .comwrote in message
news:kP******** ***********@new s.indigo.ie...
Naive... or realistic? If people are taking any meaning from the word
order,
then they're wrong to do so.
It. Takes. People. Longer. To. Understand. Unfamiliar. Things.

--

Philip Potter

Aug 10 '06 #229
"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,StrT >::TextProcess( const Letters<NumT&st ls))[5]
And again, your style doesn't make it any clearer.

--

Philip

Aug 10 '06 #230

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
9853
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
9696
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
10584
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
10644
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
10289
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...
1
7827
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
5681
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
4482
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
4062
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.