Connecting Tech Pros Worldwide Help | Site Map

Good development practices

  #1  
Old January 17th, 2008, 07:05 PM
Nickolai Leschov
Guest
 
Posts: n/a
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
  #2  
Old January 17th, 2008, 07:35 PM
Victor Bazarov
Guest
 
Posts: n/a

re: Good development practices


Nickolai Leschov wrote:
Quote:
[..] 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


  #3  
Old January 17th, 2008, 07:55 PM
Lew Pitcher
Guest
 
Posts: n/a

re: Good development practices


On Jan 17, 2:03 pm, Nickolai Leschov <nlesc...@gmail.comwrote:
Quote:
Hello,
Hi, Nickolai

[snip]
Quote:
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



  #4  
Old January 17th, 2008, 08:55 PM
Malcolm McLean
Guest
 
Posts: n/a

re: Good development practices



"Lew Pitcher" <lpitcher@teksavvy.comwrote in message
Quote:
>
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

  #5  
Old January 17th, 2008, 10:25 PM
Martin Ambuhl
Guest
 
Posts: n/a

re: Good development practices


Malcolm McLean wrote:
Quote:
>
"Lew Pitcher" <lpitcher@teksavvy.comwrote in message
Quote:
>>
>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++.

  #6  
Old January 18th, 2008, 08:15 AM
Michael DOUBEZ
Guest
 
Posts: n/a

re: Good development practices


Nickolai Leschov a écrit :
Quote:
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
  #7  
Old January 18th, 2008, 09:55 AM
Nickolai Leschov
Guest
 
Posts: n/a

re: Good development practices


Victor Bazarov wrote:
Quote:
news:comp.sofware-eng.

Thank you. I'm subscribing.
  #8  
Old January 18th, 2008, 10:05 AM
Nickolai Leschov
Guest
 
Posts: n/a

re: Good development practices


Lew Pitcher wrote:
Quote:
>
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++"
Quote:
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.

  #9  
Old January 18th, 2008, 10:55 AM
Bart van Ingen Schenau
Guest
 
Posts: n/a

re: Good development practices


On Jan 18, 11:01 am, Nickolai Leschov <nlesc...@gmail.comwrote:
Quote:
Lew Pitcher wrote:
>
Quote:
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++".
>
Quote:
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
  #10  
Old January 18th, 2008, 11:15 AM
jkherciueh@gmx.net
Guest
 
Posts: n/a

re: Good development practices


Bart van Ingen Schenau wrote:
Quote:
On Jan 18, 11:01 am, Nickolai Leschov <nlesc...@gmail.comwrote:
Quote:
>Lew Pitcher wrote:
>>
Quote:
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++".
>>
Quote:
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 :-)
  #11  
Old January 18th, 2008, 12:05 PM
Flash Gordon
Guest
 
Posts: n/a

re: Good development practices


Bart van Ingen Schenau wrote, On 18/01/08 10:47:
Quote:
On Jan 18, 11:01 am, Nickolai Leschov <nlesc...@gmail.comwrote:
Quote:
>Lew Pitcher wrote:
>>
Quote:
>>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.
Quote:
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>
Quote:
- 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
  #12  
Old January 18th, 2008, 12:25 PM
James Kuyper
Guest
 
Posts: n/a

re: Good development practices


Lew Pitcher wrote:
Quote:
On Jan 17, 2:03 pm, Nickolai Leschov <nlesc...@gmail.comwrote:
Quote:
>Hello,
>
Hi, Nickolai
>
[snip]
Quote:
>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.
  #13  
Old January 18th, 2008, 12:55 PM
Lionel B
Guest
 
Posts: n/a

re: Good development practices


Bart van Ingen Schenau wrote, On 18/01/08 10:47:
Quote:
Quote:
Quote:
>>- 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
  #14  
Old January 18th, 2008, 01:05 PM
James Kuyper
Guest
 
Posts: n/a

re: Good development practices


Bart van Ingen Schenau wrote:
....
Quote:
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.
  #15  
Old January 18th, 2008, 01:25 PM
Bart van Ingen Schenau
Guest
 
Posts: n/a

re: Good development practices


On Jan 18, 1:52 pm, Lionel B <m...@privacy.netwrote:
Quote:
Quote:
Bart van Ingen Schenau wrote, On 18/01/08 10:47:
Quote:
>- 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.
Quote:
>
--
Lionel B
Bart v Ingen Schenau
  #16  
Old January 18th, 2008, 01:35 PM
Bart van Ingen Schenau
Guest
 
Posts: n/a

re: Good development practices


On Jan 18, 2:01 pm, James Kuyper <jameskuy...@verizon.netwrote:
Quote:
Bart van Ingen Schenau wrote:
...
>
Quote:
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
  #17  
Old January 18th, 2008, 01:45 PM
James Kuyper
Guest
 
Posts: n/a

re: Good development practices


Bart van Ingen Schenau wrote:
Quote:
On Jan 18, 2:01 pm, James Kuyper <jameskuy...@verizon.netwrote:
Quote:
>Bart van Ingen Schenau wrote:
>...
>>
Quote:
>>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:
Quote:
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?
  #18  
Old January 18th, 2008, 02:05 PM
Flash Gordon
Guest
 
Posts: n/a

re: Good development practices


Lionel B wrote, On 18/01/08 12:52:
Quote:
Quote:
>Bart van Ingen Schenau wrote, On 18/01/08 10:47:
Quote:
>>>- 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
  #19  
Old January 18th, 2008, 02:45 PM
Lionel B
Guest
 
Posts: n/a

re: Good development practices


On Fri, 18 Jan 2008 13:33:47 +0000, Flash Gordon wrote:
Quote:
Lionel B wrote, On 18/01/08 12:52:
Quote:
Quote:
>>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.
Quote:
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!
Quote:
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.
Quote:
However, this is a topic for another group, possibly comp.programming.
Yes.

--
Lionel B
  #20  
Old January 18th, 2008, 04:15 PM
jacob navia
Guest
 
Posts: n/a

re: Good development practices


James Kuyper wrote:
Quote:
Lew Pitcher wrote:
Quote:
>On Jan 17, 2:03 pm, Nickolai Leschov <nlesc...@gmail.comwrote:
Quote:
>>Hello,
>>
>Hi, Nickolai
>>
>[snip]
Quote:
>>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
  #21  
Old January 18th, 2008, 05:25 PM
CBFalconer
Guest
 
Posts: n/a

re: Good development practices


Malcolm McLean wrote:
Quote:
"Lew Pitcher" <lpitcher@teksavvy.comwrote in message
>
Quote:
>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

  #22  
Old January 18th, 2008, 05:25 PM
CBFalconer
Guest
 
Posts: n/a

re: Good development practices


Nickolai Leschov wrote:
Quote:
Victor Bazarov wrote:
>
Quote:
>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

  #23  
Old January 18th, 2008, 05:25 PM
CBFalconer
Guest
 
Posts: n/a

re: Good development practices


jkherciueh@gmx.net wrote:
Quote:
>
.... snip ...
Quote:
>
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

  #24  
Old January 18th, 2008, 06:25 PM
jameskuyper@verizon.net
Guest
 
Posts: n/a

re: Good development practices


CBFalconer wrote:
....
Quote:
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.
Quote:
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.

  #25  
Old January 18th, 2008, 06:55 PM
James Kanze
Guest
 
Posts: n/a

re: Good development practices


On Jan 18, 4:22 am, CBFalconer <cbfalco...@yahoo.comwrote:
Quote:
Malcolm McLean wrote:
Quote:
"Lew Pitcher" <lpitc...@teksavvy.comwrote in message
Quote:
Quote:
Quote:
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++".
Quote:
Quote:
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.
Quote:
No. Run the following program to get the idea:
Quote:
#include <stdio.h>
Quote:
int main(void) {
int C;
Quote:
C = rand(void);
if (C) printf("C / C++ == %d\n", C / C++);
else printf("C / C++ is undefined\n");
return 0;
}
Quote:
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:james.kanze@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
  #26  
Old January 18th, 2008, 07:05 PM
James Kanze
Guest
 
Posts: n/a

re: Good development practices


On Jan 18, 4:17 pm, CBFalconer <cbfalco...@yahoo.comwrote:
Quote:
jkherci...@gmx.net wrote:
Quote:
... snip ...
Quote:
Quote:
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.
Quote:
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:james.kanze@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
  #27  
Old January 19th, 2008, 05:25 AM
CBFalconer
Guest
 
Posts: n/a

re: Good development practices


James Kanze wrote:
Quote:
CBFalconer <cbfalco...@yahoo.comwrote:
Quote:
>Malcolm McLean wrote:
Quote:
>>"Lew Pitcher" <lpitc...@teksavvy.comwrote in message
>
Quote:
Quote:
>>>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++".
>
Quote:
Quote:
>>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.
>
Quote:
>No. Run the following program to get the idea:
>
Quote:
>#include <stdio.h>
#include <stdlib.h>
Quote:
Quote:
>>
>int main(void) {
> int C;
>
Quote:
> C = rand(void);
C = rand();
Quote:
Quote:
> if (C) printf("C / C++ == %d\n", C / C++);
> else printf("C / C++ is undefined\n");
> return 0;
>}
>
Quote:
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

  #28  
Old January 19th, 2008, 11:55 AM
James Kanze
Guest
 
Posts: n/a

re: Good development practices


On Jan 19, 3:09 am, CBFalconer <cbfalco...@yahoo.comwrote:
Quote:
James Kanze wrote:
Quote:
CBFalconer <cbfalco...@yahoo.comwrote:
Quote:
Malcolm McLean wrote:
>"Lew Pitcher" <lpitc...@teksavvy.comwrote in message
Quote:
Quote:
Quote:
>>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++".
Quote:
Quote:
Quote:
>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.
Quote:
Quote:
Quote:
No. Run the following program to get the idea:
Quote:
Quote:
Quote:
#include <stdio.h>
Quote:
#include <stdlib.h>
Quote:
Quote:
Quote:
int main(void) {
int C;
Quote:
Quote:
Quote:
C = rand(void);
C = rand();
Quote:
Quote:
if (C) printf("C / C++ == %d\n", C / C++);
else printf("C / C++ is undefined\n");
return 0;
}
Quote:
Quote:
Quote:
and I expect the vast majority of results to be the value 1.
Quote:
Quote:
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?
Quote:
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++.
Quote:
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++.)
Quote:
Bah humbug. Time to kick the cat.
Don't do that. I like cats.

--
James Kanze (GABI Software) email:james.kanze@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
  #29  
Old January 19th, 2008, 02:05 PM
CBFalconer
Guest
 
Posts: n/a

re: Good development practices


James Kanze wrote:
Quote:
CBFalconer <cbfalco...@yahoo.comwrote:
>
.... snip ...
Quote:
>
Quote:
>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

  #30  
Old January 20th, 2008, 02:25 AM
Jerry Coffin
Guest
 
Posts: n/a

re: Good development practices


In article <fmo8s6$imc$1@aioe.org>, nleschov@gmail.com says...
Quote:
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.
Quote:
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.
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Good development practices Nickolai Leschov answers 29 January 20th, 2008 02:25 AM