473,839 Members | 1,519 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 10358
On Wed, 09 Aug 2006 09:27:49 +1200, Ian Collins <ia******@hotma il.com>
wrote:
>Ian Collins wrote:
>>
Not in my shop.
I forgot to say we don't do code reviews.
Nor do we, on a routine basis. We do code reviews for new hires until
we gain confidence in them. That's partly a job review and partly
training, and very much to insure correctness and maintainability . In
addition, programmers review each other's code on request.

--
Al Balmer
Sun City, AZ
Aug 8 '06 #131
In article <HM************ ********@bt.comin*****@invalid .invalid writes:
Racaille said:
Richard Heathfield wrote:
char 8 bits
short 64 bits
int 64 bits
long 64 bits

and at least one implementation does it like that.
which one ?

One of the Cray implementations . I forget which one. Nexus rings a bell, but
I wouldn't swear to it.
If I remember correctly, the standard compiler was switchable with
respect to the size of short, either 64 bits or 32 bits.
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
Aug 8 '06 #132
Al Balmer posted:
>>>Who said anything about a code review? My programming doesn't undergo
a "code review", and so I don't have to dumb it down and suck the
efficiency out of it to satisfy the politics of whomever I work for.

So, you're an amateur, coding strictly for your own ends. OK, that's
fine.

This newsgroup is comp.lang.c, not comp.lang.c.bus iness.

I am predominantly a C++ programmer, however I can program in C.

My own code does not suffer from any restrictions which a company may
impose, and so I strive to write quality, fully-portable, Standard-
compliant, efficient code.

I am not the best C++ programmer in the world, nor am I the best C
programmer in the world; however I feel that I am up there with the best.
Perhaps I'm in the top 5% maybe?

I visit newsgroups for hours each day because I want to be a brilliant
programmer. My aspiration has nothing to do with money, nothing to do with
career, and everything to do with passion. Funny as it may sound, (and as
unhealthy as it may sound), computers are a fundamental part of my life.
From childhood, while most kids were playing with batman toys, I was busy
writing batch files. I can remember how great I felt when, at the age of
about 8, I wrote a batch file to allow the user to select their startup; I
gave them a choice of command prompt, or Windows, or Norton Commander. I
spent day after day learning the in's and out's of "config.sys " and
"autoexec.b at". I can recall the joy I had experimenting with "ansi.sys",
making colourful command prompts and so forth...

My interest in computers progressed over the years, and I took up
programming in the form of Visual Basic at the age of about 12. From there,
I moved on to C++. After a few years of programming in C++, I became
complacent with "high level" programming, and wanted to get back to some
*real* programming. That's why I post on comp.lang.c.

Posting here, and over on comp.lang.c++, I am disconcerted by the ever-
frequent mention of business. I would have thought that programmers would
be passionate about what they do, and that they would turn their back on
any prospect of perverting or dumbing down their programming to satisfy the
man in the suit. At the moment, it seems that I'm in the minority here, and
so be it. Thankfully though, twenty years down the road, still shy of
forty, I forsee myself as being a programmer of the highest proficiency. If
there's anything I can learn from these newsgroups, it's that I never want
to program as an occupation.

In the future, I think I would take great satisfaction from teaching
programming, and concurrently working voluntarily on a Standard's
Committee.

--

Frederick Gotham
Aug 9 '06 #133
Frederick Gotham wrote:
>
I am predominantly a C++ programmer, however I can program in C.

My own code does not suffer from any restrictions which a company may
impose, and so I strive to write quality, fully-portable, Standard-
compliant, efficient code.
Commendable objectives.

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.

Don't just concentrate on the details of coding, keep an open mind and
investigate alternative ways of producing code.
>
Posting here, and over on comp.lang.c++, I am disconcerted by the ever-
frequent mention of business. I would have thought that programmers would
be passionate about what they do, and that they would turn their back on
any prospect of perverting or dumbing down their programming to satisfy the
man in the suit. At the moment, it seems that I'm in the minority here, and
so be it.
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.
Thankfully though, twenty years down the road, still shy of
forty, I forsee myself as being a programmer of the highest proficiency. If
there's anything I can learn from these newsgroups, it's that I never want
to program as an occupation.
Then broaden you horizons, learn as many languages and methodologies as
you can, over time you will find the path that works best for you.

--
Ian Collins.
Aug 9 '06 #134
Frederick Gotham <fg*******@SPAM .comwrites:
Al Balmer posted:
>>>>Who said anything about a code review? My programming doesn't undergo
a "code review", and so I don't have to dumb it down and suck the
efficienc y out of it to satisfy the politics of whomever I work for.

So, you're an amateur, coding strictly for your own ends. OK, that's
fine.

This newsgroup is comp.lang.c, not comp.lang.c.bus iness.
[snip]
I visit newsgroups for hours each day because I want to be a brilliant
programmer.
[snip]
In the future, I think I would take great satisfaction from teaching
programming, and concurrently working voluntarily on a Standard's
Committee.
Ok, you want to be the best C (<OT>and/or C++</OT>) programmer you can
be. That's terrific, and I say that without a trace of sarcasm.

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.)

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.

For myself, it makes me less inclined to spend any time reading
articles you post if they use your unconventional ordering. You're
not programming in a vacuum, you're participating in this newsgroup,
and you are, as Henry Spencer wrote, "creating beautiful new
impediments to understanding".

If there were some real benefit, I wouldn't be complaining.

--
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 9 '06 #135

"Frederick Gotham" <fg*******@SPAM .comwrote in message
news:O8******** ***********@new s.indigo.ie...
Philip Potter posted:
>It's almost always better to stick with a coding style that you perceive
as flawed but which everyone is used to, than to use your own style
which (despite any advantage it may offer) nobody is used to and so
nobody can read.


If you're going to be reading other people's code, you need to be used to
variety.

If part of your job is reading other people's code, then you should be
good
at it. It takes less than an hour to get used to different word orderings:

int const *p;

const int *p;

static inline int Func(...

int inline static Func(...

inline static int Func(...

static int inline Func(...

The people who are arguing that "other people should be able to read your
code" are the very people who have difficulty reading other people's code.
Big deal: I write "char unsigned" instead of "unsigned char"... is it
really that bewildering?
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.
>
At then end of the day, if you have a problem with:

char unsigned const static inline (*const Func(void))[3]

, then you should take it up with the Standards Commitee -- because right
now, it's perfectly legal, and I like it. (And please don't come back with
an argument such as the following is legal:

#define void int
#define main core
#define start {
#define end }

void core()
start
return 0;
end

--

Frederick Gotham

Aug 9 '06 #136

Frederick Gotham wrote:
Al Balmer posted:
>Perhaps you'd like to post some of your own code, and I'll point out the
flaws?
I wouldn't bother, since you and I obviously have very different ideas
as to what constitutes good code.

I'll just say that if you presented the examples you've shown in a
code review here, you'd be told to fix them.

Who said anything about a code review? My programming doesn't undergo a
"code review", and so I don't have to dumb it down and suck the efficiency
out of it to satisfy the politics of whomever I work for.
Why should a code review result in dumbing down or reduction of
efficiency? I've never known a code review do either of these things;
more often just the opposite.
If the second review wasn't drastically improved, there wouldn't be a
third.

If my second try was 40% less efficient the second time around, would it
make the cut?
Definitely not. You'd have to correct what you'd screwed up since the
first review as well as correcting what was brought up the first time.
So, do your own thing, but I hope no one else ever has to deal with
it.

God forbid they might actually adopt my style.
Well prayed, sir; I sincerely hope he does.

Aug 9 '06 #137

Frederick Gotham wrote:
Al Balmer 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.

Aug 9 '06 #138

Keith Thompson wrote:
How do you feel about this?

char const inline static unsigned (*const Func(void))[3]

Don't you think there's some advantage in having all the keywords in
alphabetical order? 8-)}
Excellent comment! You beat me to this one... GMTA (ASDO)

Aug 9 '06 #139

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.

Aug 9 '06 #140

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
9697
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
10585
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...
0
10292
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
9426
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
5682
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
5866
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
4064
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3132
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.