Good development practices

L

Lionel B

Lionel B wrote, On 18/01/08 12:52:

Because you then cannot easily take the next version of that SW that has
some new and wonderful features.

Well of course you have to deal with that - and there are plenty of tools
out there (i.e. for patching, version control, etc.) to help keep it all
sane.
Most of the OSS world works on people submitting patches back to the
projects

Yes, absolutely. And I certainly wasn't suggesting you *shouldn't* do
that!
rather than taking local copies and hacking it around. That way
everyone gets the benefits of you changes and you get the benefit of
being able to use new versions of the libraries.

Sure - although it may well be that your hacked code is deemed too
peripheral to the central purpose of the library and your patch rejected
as unnecessary bloat.
However, this is a topic for another group, possibly comp.programming.

Yes.
 
C

CBFalconer

.... snip ...

All that I have observed is that there are some people who
regularly _pretend_ that those using the phrase "C/C++" do refer
to some language of that name. That joke was funny the first time
I saw it, but it wears off over the years.

No, I think the users of the "C/C++" phrase tend to be idiots who
think that C++ is a superset of C, rather than a different
language. They also commit the crime (usually) of cross posting
between the groups.
 
J

jacob navia

James said:
Lew said:

Hi, Nickolai

[snip]
Where do I learn about things like that? I'm sorry for asking this here,
where we dicuss standard-compliant C/C++ programming, but I really don't
know any other place now. I do program in C/C++.

OK, first thing is to recognize that there is no such thing as
"standard-compliant C/C++ programming", because there is no standard
that defines something called "C/C++".

I've never understood the seriously negative responses that the use of
the term "C/C++" provokes. I will concede that it's entirely possible
that someone might use the term in the mistaken belief that it refers to
a single language, but off-hand I cannot remember ever seeing any
unambiguous evidence that someone was making that mistake. It seems
quite clear to me that in most cases, including this one, it is being
used to simplify a statement that is talking about both languages. It is
a natural pairing, because the languages are so closely related - it's
trivial to write code does just about anything you want it to do while
compiling identically under both languages (except insofar as you need
to make use of an external library which only has a C++ interface).

"standard-compliant C/C++ programming" clearly means "standard-compliant
C programming and standard-compliant C++ programming", and is a very
reasonable way of expressing that concept in a shorter form. I program
in C/C++" is an equally reasonable way of saying "I program in C and in
C++". I don't understand what it is that you find objectionable about
that usage.

I agree with this. Why make artificial oppositions?
 
J

jameskuyper

CBFalconer wrote:
....
No, I think the users of the "C/C++" phrase tend to be idiots who
think that C++ is a superset of C, rather than a different

To say that C++ is a superset of C is no more than an exaggeration.
Interpreting that exaggeration as literally and exactly true, rather
than correctly understanding the truth that it approximates, is a
mistake, but not such a severe one as to be a sign of complete idiocy.
language. They also commit the crime (usually) of cross posting
between the groups.

In my experience, they usually ask a question that they think is
relevant to both languages, and are often correct. Admittedly, they
are also often incorrect - but that's just a special case of the more
general problem of people not being aware of the fact that a given
newsgroup is the wrong one for their question. It's nothing specific
to users of the term "C/C++". We get far more inappropriate messages
from people who's question requires expert knowledge of a particular
third-party library, or a particular platform.
 
J

James Kanze

No. Run the following program to get the idea:
#include <stdio.h>
int main(void) {
int C;
C = rand(void);
if (C) printf("C / C++ == %d\n", C / C++);
else printf("C / C++ is undefined\n");
return 0;
}
and I expect the vast majority of results to be the value 1.

Funny, it doesn't compile with my compilers. Neither C nor C++.
Are you sure that there isn't a void too many in there?

Other than that, it may be legal C, but I don't think many C
programmers would intentionally write it that way; there'd be an
include <stdlib.h> in there as well.

(Of course, it would be a rare C program which didn't use malloc
somewhere. And typically, C programmers will *not* cast the
result of malloc(), which will result in a type error in C++. I
agree with you that there are probably very few programs in
existance which will compiler in both languages, but I think you
chose a bad example.)
 
J

James Kanze

(e-mail address removed) wrote:
... snip ...
No, I think the users of the "C/C++" phrase tend to be idiots who
think that C++ is a superset of C, rather than a different
language. They also commit the crime (usually) of cross posting
between the groups.

I suspect that it depends on which users, but there issues which
are common, and where it makes sense to speak of C/C++. Any
discussion of sequence points, for example. Or integral types.
Or threading. (The C and C++ committees are working together on
that one, so that the basic guarantees will be the same in both
languages.)
 
C

CBFalconer

James said:
Funny, it doesn't compile with my compilers. Neither C nor C++.
Are you sure that there isn't a void too many in there?

And a missing #include of stdlib.h. :) Also the C/C++ expression
is, strictly speaking, illegal. However it will work as long as
the two components are not calculated at the same time. :) Bah
humbug. Time to kick the cat.
 
J

James Kanze

#include <stdlib.h>
And a missing #include of stdlib.h. :)

Which shouldn't prevent it from compiling in C. I thought that
that was the point---it looks like C/C++, but in fact, is legal
C, but not legal C++.
Also the C/C++ expression is, strictly speaking, illegal.
However it will work as long as the two components are not
calculated at the same time. :)

But the results might be different:). The compiler might do
the C++ first, then read the C for the left operand of the
division.

With the include of <stdio.h>, I think that the program is a
perfect example of the sort of thing C/C++ would be applicable
to---undefined behavior because of a missing sequence point is
one thing where C++ is intentionally compatible with C. (It's
worth noting that the C++ committee is working to add support
for threading. This obviously affects sequence point issues,
and the committee is submitting all work in this regard to the C
committee for approval---the goal is that when the C committee
adds threading, it will be 100% compatible with C++.)
Bah humbug. Time to kick the cat.

Don't do that. I like cats.
 
C

CBFalconer

James said:
.... snip ...


Don't do that. I like cats.

My daughter is away until Monday, so I have to go and feed my
grandsons cat, and clean the kitty litter, and pet the beast. Lots
of motivation for kicking. :)
 
J

Jerry Coffin

Hello,

I have done some programming, mostly on embedded systems but now I would
feel like I have to learn good development practices (i.e programmer's
good manners). Let's say I want to build an application using some
established open source library or application. Do I just download the
source and hack away? Or I'd better do it in some controlled manner, i.e
set up some source control system so that I can always compute the diffs
from the original code? Or maybe I should try to keep my changes
separate from the original code base? How do I do it?

Almost regardless of what you're working with (your own code or
something you downloaded), a bit of control such as a source code
control system is usually a good idea.

You can't normally keep your changes entirely separate -- but you can
create a fork in any competent control system, and do diffs to keep
track of exactly what changes you're making.
Where do I learn about things like that? I'm sorry for asking this here,
where we dicuss standard-compliant C/C++ programming, but I really don't
know any other place now. I do program in C/C++.

comp.software-eng is the most obvious place.
 

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

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,160
Latest member
CollinStri
Top