code portability

R

Richard Heathfield

Ian Collins said:
Typical knee-jerk reaction of an anonymous closed mind.

Then tally up another knee-jerk.

Phlip in c.p has made himself a right PITN by going on and on and on about
TDD. Please don't make the same mistake. The clc group is about the C
language, not about development strategies.
 
E

ena8t8si

jmcgill said:
That's a bit harsh.

What's harsh about it? It's not topical in comp.lang.c.
The word proselytize has a bad rep with some people,
but I meant it in the literal sense of the word:

To induce someone to join one's own belief or doctrine

That seems like a fair and accurate description of the
comments I was responding to.
 
E

ena8t8si

Ian said:
Typical knee-jerk reaction of an anonymous closed mind.

Regardless of who is having a knee-jerk reaction or who has
a closed mind, the topic is still off-topic in comp.lang.c.
 
I

Ian Collins

Richard said:
Ian Collins said:




Then tally up another knee-jerk.

Phlip in c.p has made himself a right PITN by going on and on and on about
TDD. Please don't make the same mistake. The clc group is about the C
language, not about development strategies.
I certainly wouldn't want to be tarred with that brush!
 
J

jmcgill

What's harsh about it? It's not topical in comp.lang.c.

I do a great deal of unit testing, functional testing, and acceptance
testing, and I'd like to know right now if I'm going to be abused by you
if the topic comes up with regard to programming and testing C.


In particular, I would like to know if you have some sort of moderator
authority, or if you are a major contributor to the forum, or any other
reason why I should refrain from putting you in my killfile at this time.
 
F

Flash Gordon

Frederick Gotham wrote:

Posting here, and over on comp.lang.c++, I am disconcerted by the ever-
frequent mention of business.

Many of us here earn our living writing software.
> 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.

What makes you think you have to pervert or dumb down your programming
just because you are working for a company? In over 20 years I've never
had to do that. I've never had to make code less efficient due to review
although when writing assembler I did once have to add in a *lot* more
commenting because the code was too convoluted to be followed without
massive commenting (it was required to be *extremely* efficient to meet
a real time requirement).
> 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.

You seem to have developed a very strange idea of what it is to program
for a living. Matters of company style of layout are minor and many of
us have switched between style to conform. The important thing, and the
thing of interest IMHO, is solving the problems and the satisfaction of
seeing a customer successfully using your software.
In the future, I think I would take great satisfaction from teaching
programming, and concurrently working voluntarily on a Standard's
Committee.

Fine, but you still need to know about programming in the real world, be
it the open source community or commercially. 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.
 
R

Richard Heathfield

Flash Gordon said:
Frederick Gotham wrote:



Many of us here earn our living writing software.

Many of us here use third-party libraries written in C. That does not mean
that third-party libraries are topical in clc.
What makes you think you have to pervert or dumb down your programming
just because you are working for a company? In over 20 years I've never
had to do that.

I have. In one case, I was told to use a separate loop counter for each of
several (distinct) loops within a function:

int i, j, k;

for(i = 0; i < n; i++)
{
foo(p, i);
}

DoSomethingThatAffectsSomeElementsIn(p);

for(j = 0; j < n; j++)
{
bar(p, j);
}

DoSomethingThatAffectsOtherElementsIn(p);

for(k = 0; k < n; k++)
{
bar(p, k);
}

because the team leader wasn't sure whether the loop counter went out of
scope after the termination of the loop in which it was used! This, despite
the fact that the loop counters clearly had exactly the same purpose, and
affected indexing into exactly the same array.

That was a good many years ago, when I was less confident about being able
to put my case authoritatively. (I knew I was right, but couldn't prove it
to the team leader's satisfaction.)
Fine, but you still need to know about programming in the real world, be
it the open source community or commercially.

How is that relevant to comp.lang.c? I understand and indeed share your
objections to Mr Gotham's style, but surely that's his problem? He's made
his bed, and appears to be happy to lie in it. As long as he doesn't need
other people to help him out when he gets stuck, why should he change it?
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.

But not all. There's nothing in the rules that says one person can't write
programs on his own. The C Standard allows the syntactic flexibility that
Mr Gotham is exploiting, and that's what matters. If we don't wish to read
it, we don't have to.
 
E

ena8t8si

jmcgill said:
I do a great deal of unit testing, functional testing, and acceptance
testing, ...

So do I ...
and I'd like to know right now if I'm going to be abused by you
if the topic comes up with regard to programming and testing C.

If the comments are specific to C, I expect I'll read them with
interest. If I think I have something to contribute, there's
a good chance I'll reply.

If the comments aren't specific to C, but labeled "OT" in the
subject line, I might read them or I might not, depending on
how much time I have etc.

If the comments aren't specific to C, and not labeled OT,
most likely I'll do nothing if they occur only occasionally.

For repeated, non-C-specific, non-OT-labelled postings,
I might respond pointing out the non-topicality and a
request to take the topic to another newsgroup.
In particular, I would like to know if you have some sort of moderator
authority, or if you are a major contributor to the forum, or any other
reason why I should refrain from putting you in my killfile at this time.

I'm a contributor. I have no official capacity, I speak
only for me.

Having said that, the reigning culture in comp.lang.c
is to remind contributors about what's considered
topical, and especially what isn't. You might want
to read for a while before deciding which people are
worth a killfile entry. But that's up to you.
 
J

jmcgill

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

Ian Collins

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

Frederick Gotham

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

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

Frederick Gotham

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

Frederick Gotham

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

Frederick Gotham

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

Frederick Gotham

en8t8si posted:
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.
 
R

Richard

Frederick Gotham said:
Flash Gordon posted:



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

Richard

Frederick Gotham said:
Keith Thompson posted:



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

Richard

Frederick Gotham said:
Ian Collins posted:



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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top