PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.cplus > Good development practices
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Good development practices

Réponse
 
LinkBack Outils de la discussion
Vieux 18/01/2008, 19h54   #26
James Kanze
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Good development practices

On Jan 18, 4:22 am, CBFalconer <cbfalco...@yahoo.com> wrote:
> Malcolm McLean wrote:
> > "Lew Pitcher" <lpitc...@teksavvy.com> wrote 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.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.)

--
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
  Réponse avec citation
Vieux 18/01/2008, 19h56   #27
James Kanze
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Good development practices

On Jan 18, 4:17 pm, CBFalconer <cbfalco...@yahoo.com> wrote:
> 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: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
  Réponse avec citation
Vieux 19/01/2008, 03h09   #28
CBFalconer
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Good development practices

James Kanze wrote:
> CBFalconer <cbfalco...@yahoo.com> wrote:
>> Malcolm McLean wrote:
>>> "Lew Pitcher" <lpitc...@teksavvy.com> wrote 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

  Réponse avec citation
Vieux 19/01/2008, 12h51   #29
James Kanze
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Good development practices

On Jan 19, 3:09 am, CBFalconer <cbfalco...@yahoo.com> wrote:
> James Kanze wrote:
> > CBFalconer <cbfalco...@yahoo.com> wrote:
> >> Malcolm McLean wrote:
> >>> "Lew Pitcher" <lpitc...@teksavvy.com> wrote 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: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
  Réponse avec citation
Vieux 19/01/2008, 14h10   #30
CBFalconer
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Good development practices

James Kanze wrote:
> CBFalconer <cbfalco...@yahoo.com> wrote:
>

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

  Réponse avec citation
Vieux 20/01/2008, 03h16   #31
Jerry Coffin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Good development practices

In article <fmo8s6$imc$1@aioe.org>, nleschov@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.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 22h40.


Édité par : vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,14497 seconds with 14 queries