473,839 Members | 1,494 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 10352
en******@yahoo. com 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 find that extremely annoying in this case.
You might want
to read for a while before deciding
I've been part of this forum since at least 1992.
I think I have it figured out by now.
Aug 9 '06 #151
en******@yahoo. com 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.

--
Ian Collins.
Aug 9 '06 #152
Eigenvector posted:
Man I don't know where you work, but every single programmer I manage on
my system codes by the methods outlined by the customer - NOT what they
feel is appropriate. If the customer wants his int variables to be
named using some arcane mathematical formula then so be it, if they want
the int variables to be a,b,c,d,e,f,... then so be it. The coding
standard is determined by the project and the customer, never the coder
- at least in my realm.

More of a topic for comp.lang.c.bus iness.

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

--

Frederick Gotham
Aug 9 '06 #153
Ian Collins posted:
Unfortunately that's the real world we professional programmers inhabit,
although I've never had to, or in recent years required my staff to
"dumb down" programming. I'm not sure from where or on what basis you
make that observation.

Over on comp.lang.c++, many regular participants condemned the following
code, saying it was cryptic:

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

I understand it perfectly, and don't want to be dragged down with those who
fail to understand.

--

Frederick Gotham
Aug 9 '06 #154
Keith Thompson posted:
What I don't understand is how this quest leads you to declare things
backwards, using "int unsigned" rather than the far more common
"unsigned int". (Note that even in English grammar, "unsigned int"
makes more sense; "unsigned" is an adjective, and "int" is a noun --
not that that's a decisive argument.)

English is quite strange in that regard. I think most languages put their
words in order of descending importance. Irish for example:

window = fuinneog

small = beag

small window = fuinneog bheag

I think it makes sense to receive information in order of descending
importance. I like to know the type first and foremost, which is why I
prefer:

int const i = 5;

over:

const int i = 5;

It doesn't make much of a difference with small, simple, definitions, but
it certainly does work nice with long unwiedly ones.

You've invented a set of rules for how you order keywords, taking
advantage of the fact that the compiler doesn't care. The result is
difficult to read for 99% of C programmers. It's not impossible to
read, just annoyingly difficult, and for no benefit that I can see.

I wouldn't have thought people would be so puzzled by the simple ordering
of words.

--

Frederick Gotham
Aug 9 '06 #155
Flash Gordon posted:
The reality is that when more than one person works on a project it is
far easier to read if everyone uses the same coding style and in the
real world the majority of complex pieces of software are worked on by
multiple people.

I think this argument is exagerated. I can read any style, so long as it's
valid C. I'll admit, that at first, there were some things which puzzled
me, things like:

sizeof obj

instead of:

sizeof(obj)

Or:

int const *p;

instead of:

const int *p;

But is that not part of learning C? Some people put their function blocks
like so:

int Func()
{

}

while others put them like so:

int Func() {

}

It might be a little puzzling the first time you encounter it, and you
might even find it disgusting, but if you look at it objectively, you can
still read the code.

If you were to supply me with a source file which contained several
different styles, I wouldn't have a problem reading it.

--

Frederick Gotham
Aug 9 '06 #156
en8t8si posted:
First, you have to get up to their level, then you can start improving
things.


Perhaps you'd like to post some of your own code, and I'll point out the
flaws?

I suspect most potential responders believe your comments wouldn't
have enough value to be worth the effort of posting.

With suspicion like that, you should write a murder mystery book.

--

Frederick Gotham
Aug 9 '06 #157
Frederick Gotham <fg*******@SPAM .comwrites:
Flash Gordon posted:
>The reality is that when more than one person works on a project it is
far easier to read if everyone uses the same coding style and in the
real world the majority of complex pieces of software are worked on by
multiple people.


I think this argument is exagerated. I can read any style, so long as it's
valid C. I'll admit, that at first, there were some things which puzzled
me, things like:

sizeof obj

instead of:

sizeof(obj)

Or:

int const *p;

instead of:

const int *p;

But is that not part of learning C? Some people put their function blocks
like so:

int Func()
{

}

while others put them like so:

int Func() {

}

It might be a little puzzling the first time you encounter it, and you
might even find it disgusting, but if you look at it objectively, you can
still read the code.

If you were to supply me with a source file which contained several
different styles, I wouldn't have a problem reading it.
The thing you obstinately fail to recognise is this : WHY change
anything? Do you read books where the font keeps changing?

Yes, we can all *read* and understand mixed styles, but we dont like to
keep changing our focus.

There is no argument : standards on projects exist for a good
reason. And your self discovered style will not be welcomed on any
established code base. This is a simpe fact of life.
Aug 9 '06 #158
Frederick Gotham <fg*******@SPAM .comwrites:
Keith Thompson posted:
>What I don't understand is how this quest leads you to declare things
backwards, using "int unsigned" rather than the far more common
"unsigned int". (Note that even in English grammar, "unsigned int"
makes more sense; "unsigned" is an adjective, and "int" is a noun --
not that that's a decisive argument.)


English is quite strange in that regard. I think most languages put their
words in order of descending importance. Irish for example:

window = fuinneog

small = beag

small window = fuinneog bheag

I think it makes sense to receive information in order of descending
importance. I like to know the type first and foremost, which is why I
prefer:
Are you trolling? Gaelic is not an internationally recognised language
of choice for documents or code bases.

And what you think has no relevance in the real world : MOST european
based languages are adjective noun order.
Aug 9 '06 #159
Frederick Gotham <fg*******@SPAM .comwrites:
Ian Collins posted:
>Unfortunatel y that's the real world we professional programmers inhabit,
although I've never had to, or in recent years required my staff to
"dumb down" programming. I'm not sure from where or on what basis you
make that observation.


Over on comp.lang.c++, many regular participants condemned the following
code, saying it was cryptic:

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

I understand it perfectly, and don't want to be dragged down with those who
fail to understand.
Its not cryptic : it just plain sucks and may well be inefficient too.
Aug 9 '06 #160

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
10903
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
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
10645
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
10290
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
9425
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
7015
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
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...
0
5865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4063
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.