473,890 Members | 2,051 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
Ian Collins <ia******@hotma il.comwrote:
Richard Bos wrote:
Last year it was Pattern Driven Development. The year before that Rapid
Development. Now Test Driven Development is apparently the buzzword of
the day. Bah. My tests test my program development; they do not drive
it. _I_ do that.

So someone else drives you tests?
No. I do that, too. The good thing about not advocating some fashionable
cure-all method is that you can use Brain Driven Development with pure
ISO C, which is the topic of this newsgroup.

Richard
Aug 10 '06 #211
"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.
Note that I didn't say *unreadable*.

--
Philip Potter

Aug 10 '06 #212
Eigenvector posted:
>More of a topic for comp.lang.c.bus iness.

I don't work as a programmer -- I have no customer and no boss.

So then I question your devotion to your style and your confidence in
its effectiveness.

So I can't cook well if I don't work as a chef?

If you have never worked in the industry nor have
had to satisfy a customer or their requirements I don't see how you can
make judgements on your style vs. what the undoubted experts here in
this forum promote.

I cook my own food to satisfy myself.

I write my own code to satisfy myself.

Personally if I do something one way in a non-professional environment,
but a bunch of people take me aside and provide example after example of
why my method is not really in line with normal practices - I take their
suggestions to heart. You don't appear to be doing that to my untrained
eyes.

That's because I have a fully-functional brain, and don't need to be told
that:

static int Func(void) {...

is better than:

int static Func(void) {...

--

Frederick Gotham
Aug 10 '06 #213
Philip Potter posted:
It also has to include any pointer-ness of the type as well as of the
function. If you return a const char * from a static function, you'd end
up writing:

char const static *func(args)

because there's no way to pull the * left of the "static". You have
split the type up, so that you have to read the whole declaration to
realise the function returns a "const char *" and not just a "const
char".

Yes -- I consider the asterisk to be a part of the name; this is reflected
by:

int *p, q, *r;

/* p is a pointer */

/* q is an int */

/* r is a pointer */
int (*k)[5];

/* k is a pointer */

I'm not saying you shouldn't do it, nor that it's poor style or any
weasel words like that. I'm just saying it confuses me, and it'll
probably confuse others too.

Why have you chosen this style? Please tell me any benefits it could
offer.

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)

--

Frederick Gotham
Aug 10 '06 #214
Frederick Gotham wrote:
Eigenvector posted:
>>More of a topic for comp.lang.c.bus iness.

I don't work as a programmer -- I have no customer and no boss.

So then I question your devotion to your style and your confidence in
its effectiveness.

So I can't cook well if I don't work as a chef?
You won't get so much feedback as to the success of your recipes
if you cook only for yourself.
>If you have never worked in the industry nor have
had to satisfy a customer or their requirements I don't see how you can
make judgements on your style vs. what the undoubted experts here in
this forum promote.

I cook my own food to satisfy myself.

I write my own code to satisfy myself.
Then why are you wasting time trying to convince people that they
should like /your/ food? If you're coding for yourself, code for
yourself - our preferences shouldn't matter to you.

You're in the position of trying to convince eaters that it's not
/logical/ for them to dislike broccoli or parmesan or deep-fried
honeybees [1].
That's because I have a fully-functional brain,
No-one has a fully functional brain; brains have mutable (and
mutated) state.

[1] Bleagh.

--
Chris "fixpoint operator" Dollin
"Who do you serve, and who do you trust?" /Crusade/

Aug 10 '06 #215
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.

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:

static unsigned volatile i = 5;

Moving on to functions, we just make parentheses a part of the name:

enum { SystemMemAddres s = 0xFFF776 };

int const volatile static (*Func(void))[5]
{
return (int const volatile (*)[5])SystemMemAddre ss;
}

int main()
{
int const volatile *const p = *Func();
}

--

Frederick Gotham
Aug 10 '06 #216
Chris Dollin posted:
>So I can't cook well if I don't work as a chef?

You won't get so much feedback as to the success of your recipes
if you cook only for yourself.

Yes, but I have my own sense of judgement.

It either tastes good or it doesn't.

It either runs fast and without crashing, or it doesn't.

>>If you have never worked in the industry nor have
had to satisfy a customer or their requirements I don't see how you can
make judgements on your style vs. what the undoubted experts here in
this forum promote.

I cook my own food to satisfy myself.

I write my own code to satisfy myself.

Then why are you wasting time trying to convince people that they
should like /your/ food? If you're coding for yourself, code for
yourself - our preferences shouldn't matter to you.

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.

--

Frederick Gotham
Aug 10 '06 #217
Frederick Gotham wrote:
Chris Dollin posted:
>>So I can't cook well if I don't work as a chef?

You won't get so much feedback as to the success of your recipes
if you cook only for yourself.

Yes, but I have my own sense of judgement.

It either tastes good or it doesn't.
/To you/.
It either runs fast and without crashing, or it doesn't.
It's either maintainable or it isn't.
>>>If you have never worked in the industry nor have
had to satisfy a customer or their requirements I don't see how you can
make judgements on your style vs. what the undoubted experts here in
this forum promote.

I cook my own food to satisfy myself.

I write my own code to satisfy myself.

Then why are you wasting time trying to convince people that they
should like /your/ food? If you're coding for yourself, code for
yourself - our preferences shouldn't matter to you.

I'm not trying to convice people to start writing:

int const static *Func(void);
Just as well.
But rather to explain to them that it's a perfectly acceptable variant.
But it /isn't/. And the proof is, it's not being accepted. You keep
saying that it's perfectly acceptable, look, the grammar allows it
and you /can/ read it, see! and it's just like trying to convince me
that broccoli or liver tastes /nice/, ugh spit.

You're saying that you-all could get used to something different. We-all
are saying "what's the return on investment?". Since there isn't one,
I'm surprised you're surprised that people aren't interested in making
the effort.

"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/.

--
Chris "seeker" Dollin
Meaning precedes definition.

Aug 10 '06 #218
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?

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.

--

Frederick Gotham
Aug 10 '06 #219
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?

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.
The is order word important fool you.

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.
Aug 10 '06 #220

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
11207
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...
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
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
2
4251
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.