473,387 Members | 1,516 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,387 software developers and data experts.

The worst thing about C++

#
--
"If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true." - Bertrand
Russell

Jul 23 '05 #1
10 1927
Steven T. Hatton wrote:
#

<rant>
And a close second and closely related flaw is .h, .H .hh, .HH .h++, .H++,
<osg/NoExtension>, .c, .C, .cc, .CC, .cpp, .CPP .c++, .C++, and who knows
what else. It makes managing a code base extremely difficult(manually, or
with automated tools), and adds nothing useful to the language.
</rant>
--
"If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true." - Bertrand
Russell

Jul 23 '05 #2
Steven T. Hatton wrote:
Steven T. Hatton wrote:
#

<rant>
And a close second and closely related flaw is .h, .H .hh, .HH .h++, .H++,
<osg/NoExtension>, .c, .C, .cc, .CC, .cpp, .CPP .c++, .C++, and who knows
what else. It makes managing a code base extremely difficult(manually, or
with automated tools), and adds nothing useful to the language.
</rant>


That's the beauty of the 'rename' command. :)

--
Alvin
Jul 23 '05 #3
Steven T. Hatton wrote:
#


?

Is this an effort to recite the "don't lean on the preprocessor" admonitions
from all the C++ tutorials that don't suck?

Finding the real worst thing about C++ would require many lifetimes of
careful, painstaking research. I'm certain the inventor of the language
didn't realize the copy construction rules and the exception propagation
rules would collude to make assignment operators depend on an
exception-proof swap() method. But don't quote me on that.

--
Phlip
http://www.c2.com/cgi/wiki?ZeekLand
Jul 23 '05 #4
In message <_9********************@speakeasy.net>, Steven T. Hatton
<ch********@germania.sup> writes
Steven T. Hatton wrote:
#

<rant>
And a close second and closely related flaw is .h, .H .hh, .HH .h++, .H++,
<osg/NoExtension>, .c, .C, .cc, .CC, .cpp, .CPP .c++, .C++, and who knows
what else. It makes managing a code base extremely difficult(manually, or
with automated tools), and adds nothing useful to the language.
</rant>


None of which is a flaw of, or indeed anything to do with, the standard
C++ language we're supposed to discuss here.

--
Richard Herring
Jul 23 '05 #5
Alvin wrote:
Steven T. Hatton wrote:
Steven T. Hatton wrote:
# <rant>
And a close second and closely related flaw is .h, .H .hh, .HH .h++,
.H++, <osg/NoExtension>, .c, .C, .cc, .CC, .cpp, .CPP .c++, .C++, and who
knows
what else. It makes managing a code base extremely difficult(manually,
or with automated tools), and adds nothing useful to the language.
</rant>


That's the beauty of the 'rename' command. :)


IIRC RENAME is a DOS command. Suppose I have hundreds of files that
#include files using various extension for the file names.

#!/bin/bash

function backupCPlusPlus()
{
local BACKUP=$STH/"backup-c++"/$PWD-$(date +%F-%H-%M-%S)/
test -d $BACKUP || mkdir -p $BACKUP;
cp -r * $BACKUP;
}

function kdev2emacs()
{
for f in *.h; do
test -f $f && cat $f | sed -e /"#include "/s/"\.h\([\"\>]\)"/.hh\\1/ ${f%%.h}.hh; mv $f old;
done

for f in *.cpp; do
test -f $f && cat $f | sed -e /"#include "/s/"\.h\([\"\>]\)"/.hh\\1/ ${f%%.cpp}.cc;

mv $f old;
done
}
Works great if everything in the emacs code base uses .hh. But that won't
happen if I build against boost and OSG. Boost uses .hpp and OSG uses no
extension. Further more, I don't want boost and OSG #includs modified. I
guess I could go through my code base and find all the filenames I use, and
check each #include against that list, before I make a modification.

But that's only one problem. There is also a problem of telling the tool
(e.g., Emacs speedbar) which files contain C++ source code. OSG include
files contain an Emacs mode specification line which works for determining
the type of the file being loaded, but is not used by tools such as
speedbar to determine the type of files in the current directory. Sure,
someone can write code to check each file in the current directory for a
mode specification line, but that means that every tool that is going to
use extensionless headers with mode specification lines has to do that.

It's much easier just to specify that .el means Emacs Lisp, .java means Java
source, .c means 'C' source, etc.
--
"If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true." - Bertrand
Russell

Jul 23 '05 #6
Richard Herring wrote:
In message <_9********************@speakeasy.net>, Steven T. Hatton
<ch********@germania.sup> writes
Steven T. Hatton wrote:
#

<rant>
And a close second and closely related flaw is .h, .H .hh, .HH .h++, .H++,
<osg/NoExtension>, .c, .C, .cc, .CC, .cpp, .CPP .c++, .C++, and who knows
what else. It makes managing a code base extremely difficult(manually, or
with automated tools), and adds nothing useful to the language.
</rant>


None of which is a flaw of, or indeed anything to do with, the standard
C++ language we're supposed to discuss here.


It has to do with the usability of the C++ programming language.

--
"If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true." - Bertrand
Russell

Jul 23 '05 #7
Steven T. Hatton wrote:
It has to do with the usability of the C++ programming language.

Meaning? (I think I am going to see how "C# handles this" yet another time. C++ handles
the .NET dlls the same under .NET. Dlls are not the same as source code files).

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #8
In message <O8********************@speakeasy.net>, Steven T. Hatton
<ch********@germania.sup> writes
Richard Herring wrote:
In message <_9********************@speakeasy.net>, Steven T. Hatton
<ch********@germania.sup> writes
Steven T. Hatton wrote:

#
<rant>
And a close second and closely related flaw is .h, .H .hh, .HH .h++, .H++,
<osg/NoExtension>, .c, .C, .cc, .CC, .cpp, .CPP .c++, .C++, and who knows
what else. It makes managing a code base extremely difficult(manually, or
with automated tools), and adds nothing useful to the language.
</rant>


None of which is a flaw of, or indeed anything to do with, the standard
C++ language we're supposed to discuss here.


It has to do with the usability of the C++ programming language.


No, it has to do with how C++ IDEs and other development tools integrate
into the environment provided by your chosen OS. That has nothing to do
with the language itself.

--
Richard Herring
Jul 23 '05 #9
Richard Herring wrote:
In message <O8********************@speakeasy.net>, Steven T. Hatton
<ch********@germania.sup> writes
Richard Herring wrote:
In message <_9********************@speakeasy.net>, Steven T. Hatton
<ch********@germania.sup> writes
Steven T. Hatton wrote:

> #
<rant>
And a close second and closely related flaw is .h, .H .hh, .HH .h++,
.H++, <osg/NoExtension>, .c, .C, .cc, .CC, .cpp, .CPP .c++, .C++, and
who knows
what else. It makes managing a code base extremely difficult(manually,
or with automated tools), and adds nothing useful to the language.
</rant>

None of which is a flaw of, or indeed anything to do with, the standard
C++ language we're supposed to discuss here.


It has to do with the usability of the C++ programming language.


No, it has to do with how C++ IDEs and other development tools integrate
into the environment provided by your chosen OS. That has nothing to do
with the language itself.


This is not the case. The problems I am describing are not platform
specific. I can emulate a DOS shell under Linux, and I can run a posix
compliant shell under NT(AKA XP). Almost all tools I use are platform
independent. A person who does not have a reason to deal with the issues
related to using different tools at different times to work on the same
code base will probably not appreciate the nature of my concerns. If a
person has never studied the problem of parsing C++ source code to extract
useful information to provide to the programmer at edit time, he will
probably not appreciate the difficulties introduced by the use of the
preprocessor. If I were to restrict myself to using only one set of tools
in a clearly defined environment such as NT user space where I could, more
or less, predict all the variables, much of the problems I am describing
would be non-issues. That is not the spirit in which C++ was created, and
it is not good for the longterm health of the computing field.

Nonetheless, some of this goes beyond using multiple tools. It is utterly
absurd to have a langue support features that cause a compiler to detect
errors in code located in "header files" the programmer did not write, and
which contain no errors, because there is a minor syntax error in code the
programmer did write. But this happens with C++.

I understand the advantage the preprocessor provides to C++ programmers. It
allows for the crossing of the boundary between the language and the
observer of the language. This is a form of selfreferential recursion that
we might call selfawareness, or introspection. Stringification demonstrates
this very well. If I want my program to contain both the product of
compiling a function definition, and the human readable information
contained in the function definition, I have to have a way to access that
human readable information at runtime. Stringizing such information with a
Macro is a way to generate both the source and a characters representation
of the source to be included in the program at runtime.

With some languages such as Mathematica, Lisp, Java, ECMAScript, C#(?), that
is simply part of the way the language works. With the interpreted
languages, it is rather straight forward. The source code *is* the
executable. With compiled languages, it takes more intentional thought to
support such a feature.

I understand that C++ would incur costs in both space and time if such
introspection were required of all executable code. Introducing support
for it into the core language might add excessive complexity to an already
dauntingly complex specification.

All that being said, I believe much use of the preprocessor to generate
cookiecutter code is a way for the programmer to avoid correctly solving
the underlying programming problem. Virtually every use of the
preprocessor that I have seen that could not be replaced with a native C++
construct has to do with storing information about the source code to be
available at runtime.
--
"If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true." - Bertrand
Russell

Jul 23 '05 #10
In message <Ro********************@speakeasy.net>, Steven T. Hatton
<ch********@germania.sup> writes
Richard Herring wrote:
In message <O8********************@speakeasy.net>, Steven T. Hatton
<ch********@germania.sup> writes
Richard Herring wrote:

In message <_9********************@speakeasy.net>, Steven T. Hatton
<ch********@germania.sup> writes
>Steven T. Hatton wrote:
>
>> #
><rant>
>And a close second and closely related flaw is .h, .H .hh, .HH .h++,
>.H++, <osg/NoExtension>, .c, .C, .cc, .CC, .cpp, .CPP .c++, .C++, and
>who knows
>what else. It makes managing a code base extremely difficult(manually,
>or with automated tools), and adds nothing useful to the language.
></rant>

None of which is a flaw of, or indeed anything to do with, the standard
C++ language we're supposed to discuss here.

It has to do with the usability of the C++ programming language.


No, it has to do with how C++ IDEs and other development tools integrate
into the environment provided by your chosen OS. That has nothing to do
with the language itself.


This is not the case. The problems I am describing are not platform
specific.


Then your <rant> </rant> was obscurely worded. I interpreted it as a
complaint about (the lack of) file naming conventions, or possibly the
separation of interface and implementation into separate files, but you
seem to be talking about something entirely different.

--
Richard Herring
Jul 23 '05 #11

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

Similar topics

59
by: Monte Gardner | last post by:
Here's the situation: I'm a part-time instructor at ITT. In about 2 weeks, I'm going to start teaching a class titled 'web authoring and scripting'. I figures that a fun yet interesting way to...
1
by: CBFalconer | last post by:
Additions welcome. Without further ado, I present. /* ---------- worst.c -----------*/ /* The objective here is to include as many C errors as possible, without triggering the compiler into...
29
by: CBFalconer | last post by:
Presented without further comment for "improvement" /* ---------- worst.c -----------*/ /* The objective here is to include as many C errors as possible, without triggering the compiler into...
6
by: aron t | last post by:
Hi, I am good php programmer and want to learn asp.net. Can someone tell me what are the best and the worst features of ASP.NET? thanks
23
by: Steven T. Hatton | last post by:
This is one of the first obstacles I encountered when getting started with C++. I found that everybody had their own idea of what a string is. There was std::string, QString, xercesc::XMLString,...
110
by: alf | last post by:
Hi, is it possible that due to OS crash or mysql itself crash or some e.g. SCSI failure to lose all the data stored in the table (let's say million of 1KB rows). In other words what is the worst...
75
by: Steven T. Hatton | last post by:
No, this is not a troll, and I am not promoting Java, C-flat, D, APL, Bash, Mathematica, SML, or LISP. A college teacher recently posted to this newsgroup regarding her observation that there has...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.