473,325 Members | 2,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Good development practices

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?

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

Regards,
Nickolai Leschov
Jan 17 '08 #1
29 2285
Nickolai Leschov wrote:
[..] I
would feel like I have to learn good development practices [..]

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++.
news:comp.sofware-eng.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jan 17 '08 #2
On Jan 17, 2:03 pm, Nickolai Leschov <nlesc...@gmail.comwrote:
Hello,
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++".

However, there /are/ standards for the C language, and /different/
standards for the C++ language. You are going to have to choose which
language you want to learn about wrt "standard-compliant" programming.
If you are planning to program in /both/ C and C++, you'll have to
learn both standards, and a bunch of things about inter-language calls
(which, IIRC, the C++ standard talks about, but the C standard does
not).

Having said all that, neither comp.lang.c nor comp.lang.c++ seem to me
to be the best place to discuss the theory of "standard-compliant
programming". Both of these newsgroups discuss the practice of
"standard-compliant programming", and try to leave the theory to other
groups.

HTH
--
Lew

Jan 17 '08 #3

"Lew Pitcher" <lp******@teksavvy.comwrote in message
>
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++".
Standards-compilant C/C++ would be a language that anyone would call C, or C
with a few twiddles, but actually conforms to the C++ standard.
Many thousands of such programs are written.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Jan 17 '08 #4
Malcolm McLean wrote:
>
"Lew Pitcher" <lp******@teksavvy.comwrote in message
>>
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++".
Standards-compilant C/C++ would be a language that anyone would call C,
or C with a few twiddles, but actually conforms to the C++ standard.
Many thousands of such programs are written.
Or a language that anyone would call C++, or C++ with a few twiddles,
but actually conforms to the C standard. Many thousands of such
programs are written.

Your parochialism is showing. The fact is that there is no C/C++
language, and no standard to conform to. Not to bother with the obvious
point that the expression 'C/C++' is a violation of the standards of
either C or C++.

Jan 17 '08 #5
Nickolai Leschov a écrit :
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?

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++.
You can learn some of it from de Herb Sutter and Andrei Alexandrescu:
http://www.amazon.fr/Coding-Standard.../dp/0321113586

Michael
Jan 18 '08 #6
Victor Bazarov wrote:
news:comp.sofware-eng.

Thank you. I'm subscribing.
Jan 18 '08 #7
Lew Pitcher wrote:
>
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++".

However, there /are/ standards for the C language, and /different/
standards for the C++ language. You are going to have to choose which
language you want to learn about wrt "standard-compliant" programming.
Yes, I know what is C and what is C++, they are different languages, I
just wrote "C/C++" to save time, not because I think they are the same
or something like that.
Please don't be so pedantic. You know what I meant, don't you?

My question is about good practices applicable to both C and C++,
(that's why I post this to both newsgroups) with emphasis on "good
practices", not "C/C++"
Having said all that, neither comp.lang.c nor comp.lang.c++ seem to me
to be the best place to discuss the theory of "standard-compliant
programming".
This is the term I used to name the topic of discussions in this
newsgroup is I see it. I mean programming in the language, not specific
implementation.

Jan 18 '08 #8
On Jan 18, 11:01 am, Nickolai Leschov <nlesc...@gmail.comwrote:
Lew Pitcher wrote:
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++".
However, there /are/ standards for the C language, and /different/
standards for the C++ language. You are going to have to choose which
language you want to learn about wrt "standard-compliant" programming.

Yes, I know what is C and what is C++, they are different languages, I
just wrote "C/C++" to save time, not because I think they are the same
or something like that.
Please don't be so pedantic. You know what I meant, don't you?
Actually, no we did not know that.
There are just too many people about who really think that there is a
language called "C/C++" to assume that a poster knows about the
distinction between C and C++ when he uses the term C/C++.

And if you can't stand pedantery, comp.lang.c and comp.lang.c++ will
not meet your tastes, because they are full of it.

To answer your original questions:
- Using source control is always a good idea. Agood source control
system lets you easily find out when and why certain changes were
made. This I use often in finding the cause of bugs that I try to
solve.
- When writing an application that uses third-party software (open
source or not), you should regard the third-party software as 'read-
only'.
Even if you are allowed to, writing your application intermixed with
library code is likely to break all sorts of things. In the very
least, it breaks the principle of modularity.

Bart v Ingen Schenau
Jan 18 '08 #9
Bart van Ingen Schenau wrote:
On Jan 18, 11:01 am, Nickolai Leschov <nlesc...@gmail.comwrote:
>Lew Pitcher wrote:
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++".
However, there /are/ standards for the C language, and /different/
standards for the C++ language. You are going to have to choose which
language you want to learn about wrt "standard-compliant" programming.

Yes, I know what is C and what is C++, they are different languages, I
just wrote "C/C++" to save time, not because I think they are the same
or something like that.
Please don't be so pedantic. You know what I meant, don't you?

Actually, no we did not know that.
There are just too many people about who really think that there is a
language called "C/C++" to assume that a poster knows about the
distinction between C and C++ when he uses the term C/C++.
[snip]

I think your claim is plain false. I never met someone who "really think(s)
that there is a language called 'C/C++'". Also, I have never encountered
the case that a poster using "C/C++" reacted with even the slightest amount
of surprise when informed that there is no language that goes by the
name "C/C++". I wonder if there are, say, three threads from the archive
where it actually transpires that a poster thaught there is a language
called "C/C++". Could you quote even one? (Maybe, there is a difference in
comp.lang.c and comp.lang.c++. My observation is based upon the C++ group.
So, it could be possible that the C forum is teeming with posters who
actually think C/C++ does name a language.)

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

Kai-Uwe Bux

ps.: Come to think of it, maybe there is a C/C++ language. I think Comeau
offers a compiler for that one :-)
Jan 18 '08 #10
Bart van Ingen Schenau wrote, On 18/01/08 10:47:
On Jan 18, 11:01 am, Nickolai Leschov <nlesc...@gmail.comwrote:
>Lew Pitcher wrote:
>>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++".
However, there /are/ standards for the C language, and /different/
standards for the C++ language. You are going to have to choose which
language you want to learn about wrt "standard-compliant" programming.
Yes, I know what is C and what is C++, they are different languages, I
just wrote "C/C++" to save time, not because I think they are the same
or something like that.
Please don't be so pedantic. You know what I meant, don't you?

Actually, no we did not know that.
There are just too many people about who really think that there is a
language called "C/C++" to assume that a poster knows about the
distinction between C and C++ when he uses the term C/C++.
Also please note that in significant area what is good practice in C++
is not even possible in C. A simple example is using new/delete in C++
which do not exist in C. I know the OP wanted the non-language stuff,
but it is the language stuff which is topical here and there are
significant differences.
And if you can't stand pedantery, comp.lang.c and comp.lang.c++ will
not meet your tastes, because they are full of it.
True.

<snip>
- When writing an application that uses third-party software (open
source or not), you should regard the third-party software as 'read-
only'.
Apart from submitting bug fixes back to the developers.
--
Flash Gordon
Jan 18 '08 #11
Lew Pitcher wrote:
On Jan 17, 2:03 pm, Nickolai Leschov <nlesc...@gmail.comwrote:
>Hello,

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.
Jan 18 '08 #12
Bart van Ingen Schenau wrote, On 18/01/08 10:47:
>>- When writing an application that uses third-party software (open
source or not), you should regard the third-party software as 'read-
only'.
Huh? Why on earth should you not (license permitting) patch/hack/modify
third-party software to your heart's content and use it in your
application? The entire open source software world relies on being able
to do this.

--
Lionel B
Jan 18 '08 #13
Bart van Ingen Schenau wrote:
....
There are just too many people about who really think that there is a
language called "C/C++" to assume that a poster knows about the
Could you cite an example? I don't doubt that you can, but I'd be
surprised if you can find one quickly. I've been reading comp.std.c and
comp.std.c++ for more than a decade, and I've seen "C/C++" used, and
criticized, many times. Off-hand, I can't remember a single criticism
that was actually justified, though there were probably one or two cases.
Jan 18 '08 #14
On Jan 18, 1:52 pm, Lionel B <m...@privacy.netwrote:
Bart van Ingen Schenau wrote, On 18/01/08 10:47:
>- When writing an application that uses third-party software (open
source or not), you should regard the third-party software as 'read-
only'.

Huh? Why on earth should you not (license permitting) patch/hack/modify
third-party software to your heart's content and use it in your
application? The entire open source software world relies on being able
to do this.
I am not saying that you should not modify the library at all (licence
permitting), but that such modifications should not be done as part of
developing an application.

If, during the development of an application, you find that a
modification to a supporting library is needed, I would execute the
modification as a separate project.
For a small patch, the distinction between the two projects can be as
small as the mental hat you are wearing, but I would still regard them
as logically separate projects.
>
--
Lionel B
Bart v Ingen Schenau
Jan 18 '08 #15
On Jan 18, 2:01 pm, James Kuyper <jameskuy...@verizon.netwrote:
Bart van Ingen Schenau wrote:
...
There are just too many people about who really think that there is a
language called "C/C++" to assume that a poster knows about the

Could you cite an example? I don't doubt that you can, but I'd be
surprised if you can find one quickly. I've been reading comp.std.c and
comp.std.c++ for more than a decade, and I've seen "C/C++" used, and
criticized, many times. Off-hand, I can't remember a single criticism
that was actually justified, though there were probably one or two cases.
My experience is mostly based on what I read in the group
alt.comp.lang.learn.c-c++.
Perhaps the situation is better in the groups that deal with only one
of the languages.
As you asked for an example, here is one:
http://groups.google.com/group/alt.c...6ca478ac969048

Bart v Ingen Schenau
Jan 18 '08 #16
Bart van Ingen Schenau wrote:
On Jan 18, 2:01 pm, James Kuyper <jameskuy...@verizon.netwrote:
>Bart van Ingen Schenau wrote:
...
>>There are just too many people about who really think that there is a
language called "C/C++" to assume that a poster knows about the
Could you cite an example? I don't doubt that you can, but I'd be
surprised if you can find one quickly. I've been reading comp.std.c and
comp.std.c++ for more than a decade, and I've seen "C/C++" used, and
criticized, many times. Off-hand, I can't remember a single criticism
that was actually justified, though there were probably one or two cases.

My experience is mostly based on what I read in the group
alt.comp.lang.learn.c-c++.
Perhaps the situation is better in the groups that deal with only one
of the languages.
As you asked for an example, here is one:
http://groups.google.com/group/alt.c...6ca478ac969048

Bart v Ingen Schenau
The relevant statement from that thread was:
I am attempting to move to C/C++ from a Java background.
I saw nothing to indicate that he meant anything other than

"I am attempting to move to C and C++ from a Java background."

Can you cite one statement he made that is inconsistent with this
interpretation?
Jan 18 '08 #17
Lionel B wrote, On 18/01/08 12:52:
>Bart van Ingen Schenau wrote, On 18/01/08 10:47:
>>>- When writing an application that uses third-party software (open
source or not), you should regard the third-party software as 'read-
only'.

Huh? Why on earth should you not (license permitting) patch/hack/modify
third-party software to your heart's content and use it in your
application? The entire open source software world relies on being able
to do this.
Because you then cannot easily take the next version of that SW that has
some new and wonderful features.

Most of the OSS world works on people submitting patches back to the
projects 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.

However, this is a topic for another group, possibly comp.programming.
--
Flash Gordon
Jan 18 '08 #18
On Fri, 18 Jan 2008 13:33:47 +0000, Flash Gordon wrote:
Lionel B wrote, On 18/01/08 12:52:
>>Bart van Ingen Schenau wrote, On 18/01/08 10:47:
- When writing an application that uses third-party software (open
source or not), you should regard the third-party software as 'read-
only'.

Huh? Why on earth should you not (license permitting) patch/hack/modify
third-party software to your heart's content and use it in your
application? The entire open source software world relies on being able
to do this.

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.

--
Lionel B
Jan 18 '08 #19
James Kuyper wrote:
Lew Pitcher wrote:
>On Jan 17, 2:03 pm, Nickolai Leschov <nlesc...@gmail.comwrote:
>>Hello,

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?
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Jan 18 '08 #20
Malcolm McLean wrote:
"Lew Pitcher" <lp******@teksavvy.comwrote in message
>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++".

Standards-compilant C/C++ would be a language that anyone would
call C, or C with a few twiddles, but actually conforms to the
C++ standard. Many thousands of such programs are written.
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.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.

--
Posted via a free Usenet account from http://www.teranews.com

Jan 18 '08 #21
Nickolai Leschov wrote:
Victor Bazarov wrote:
>news:comp.sofware-eng.

Thank you. I'm subscribing.
You might do better with <news:comp.software-eng>. t's matter.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.

--
Posted via a free Usenet account from http://www.teranews.com

Jan 18 '08 #22
jk********@gmx.net wrote:
>
.... 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.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.

--
Posted via a free Usenet account from http://www.teranews.com

Jan 18 '08 #23
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.

Jan 18 '08 #24
On Jan 18, 4:22 am, CBFalconer <cbfalco...@yahoo.comwrote:
Malcolm McLean wrote:
"Lew Pitcher" <lpitc...@teksavvy.comwrote in message
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++".
Standards-compilant C/C++ would be a language that anyone would
call C, or C with a few twiddles, but actually conforms to the
C++ standard. Many thousands of such programs are written.
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.hin 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.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Jan 18 '08 #25
On Jan 18, 4:17 pm, CBFalconer <cbfalco...@yahoo.comwrote:
jkherci...@gmx.net wrote:
... 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.
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.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Jan 18 '08 #26
James Kanze wrote:
CBFalconer <cbfalco...@yahoo.comwrote:
>Malcolm McLean wrote:
>>"Lew Pitcher" <lpitc...@teksavvy.comwrote in message
>>>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++".
>>Standards-compilant C/C++ would be a language that anyone would
call C, or C with a few twiddles, but actually conforms to the
C++ standard. Many thousands of such programs are written.
>No. Run the following program to get the idea:
>#include <stdio.h>
#include <stdlib.h>
>>
int main(void) {
int C;
> C = rand(void);
C = rand();
> 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?
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.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.

--
Posted via a free Usenet account from http://www.teranews.com

Jan 19 '08 #27
On Jan 19, 3:09 am, CBFalconer <cbfalco...@yahoo.comwrote:
James Kanze wrote:
CBFalconer <cbfalco...@yahoo.comwrote:
Malcolm McLean wrote:
"Lew Pitcher" <lpitc...@teksavvy.comwrote in message
>>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++".
>Standards-compilant C/C++ would be a language that anyone would
call C, or C with a few twiddles, but actually conforms to the
C++ standard. Many thousands of such programs are written.
No. Run the following program to get the idea:
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int C;
C = rand(void);
C = rand();
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?
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.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Jan 19 '08 #28
James Kanze wrote:
CBFalconer <cbfalco...@yahoo.comwrote:
.... snip ...
>
>Bah humbug. Time to kick the cat.

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

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.

--
Posted via a free Usenet account from http://www.teranews.com

Jan 19 '08 #29
In article <fm**********@aioe.org>, nl******@gmail.com says...
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.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Jan 20 '08 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: matty | last post by:
Go away for a few days and you miss it all... A few opinions... Programming is a craft more than an art (software engineering, not black magic) and as such, is about writing code that works,...
10
by: KN | last post by:
I know both are pretty much the same and it comes down to personal choice. But I have to make the choice for the team. Things so far that I am considering 1. XML documentation in C# -- thats...
217
by: gyromagnetic | last post by:
The following url points to an article written by Damian Conway entitled "Ten Essential Development Practices": http://www.perl.com/pub/a/2005/07/14/bestpractices.html Althought the article has...
59
by: Alan Silver | last post by:
Hello, This is NOT a troll, it's a genuine question. Please read right through to see why. I have been using Vusual Basic and Classic ASP for some years, and have now started looking at...
2
by: Amelyan | last post by:
Could anyone recommend a book (or a web site) that defines best practices in ASP.NET application development? E.g. 1) Precede your control id's with type of control btnSubmit, txtName, etc. 2)...
4
by: Collin Peters | last post by:
I have searched the Internet... but haven't found much relating to this. I am wondering on what the best practices are for migrating a developmemnt database to a release database. Here is the...
1
by: Pablo | last post by:
Hello all, Hope today finds you well. I'm looking to take my knowledge of best practices within the development lifecycle to the next level. Basically I want to follow industry recognised,...
2
by: dotnet dude | last post by:
What boook do you guys recommend for somebody with the software development backgroud who wants to get started from scratch with the designing of good sofware application. I am interested in...
29
by: Nickolai Leschov | last post by:
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.