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

Could this be done on every ISO/IEC 14882:2003 implementation?

This was written for the gnu.g++.help list. It rather clearly spells out the
most important feature of Java that I believe C++ lacks. I really don't
believe the C++ Standard sepcifies enough for a generic mechanism to
accomplish the comperable tasks demonstrated for Java below. I've already
proposed on comp.std.c++ that the next version of the standard specify a
similar functionality for a C++ implementation.

I know it can be unpopular to compare Java to C++, but there are certain
features of Java which C++ lacks, and which give the programmer significant
leverage to exploit available libraries.

I wrote the following bash for the sake of writing this [gnu.g++.help]
response:

*#!/bin/bash

function jarlist() {
****for*j*in*${CLASSPATH//:/'*'};*do*
********echo*$j;
****done*
}

function classlist() {
****for*j*in*${CLASSPATH//:/'*'};*do
********jar*-tf*$j;
****done*
}

function jpgrep() {
****for*j*in*${CLASSPATH//:/'*'};*do
********h="";
********h=$(jar*-tf*$j*|*grep*.class$*|*grep*$1)
********for*c*in*$h;do
*************echo*$c;
********done
****done*
}

function jif() {
****for*j*in*${CLASSPATH//:/'*'};*do
********h="";
********h=$(jar*-tf*$j*|*grep*.class$*|*grep*$1)
********for*c*in*$h;do
************test*-n*"$c"*&&*echo*$c*&&*javap*${c%%.class}
********done
****done*
}
##################### EOF ###################################

If there is a Java class I wish to use in my code, I can put the code listed
above in a file called ~/bin/jq. Source it:
Fri Jun 04 11:45:51:> . jq

If I know the class contains the substring 'System' I type:
Fri Jun 04 11:45:51:> jpgrep System
org/apache/xml/utils/SystemIDResolver.class
org/apache/xpath/functions/FuncSystemProperty.class
org/apache/xmlrpc/SystemHandler.class
org/apache/xindice/core/MetaSystemCollection.class
org/apache/xindice/core/SystemCollection.class

If I want to see the interfaces for each of these, I enter:

org/apache/xml/utils/SystemIDResolver.class
Compiled from "SystemIDResolver.java"
public class org.apache.xml.utils.SystemIDResolver extends java.lang.Object{
****public*org.apache.xml.utils.SystemIDResolver() ;
****public*static*java.lang.String*getAbsoluteURI( java.lang.String);
*******throws*javax/xml/transform/TransformerException
****public*static*java.lang.String
getAbsoluteURIFromRelative(java.lang.String);
****public*static*java.lang.String
getAbsoluteURI(java.lang.String,java.lang.String);
*******throws*javax/xml/transform/TransformerException
}

org/apache/xpath/functions/FuncSystemProperty.class
Compiled from "FuncSystemProperty.java"
//...
}

org/apache/xmlrpc/SystemHandler.class
Compiled from "SystemHandler.java"
public class org.apache.xmlrpc.SystemHandler extends java.lang.Object
implements org.apache.xmlrpc.ContextXmlR
//..
execute(java.lang.String,java.util.Vector,org.apac he.xmlrpc.XmlRpcContext);
*******throws*java/lang/Exception
}

org/apache/xindice/core/MetaSystemCollection.class
Compiled from "MetaSystemCollection.java"
public final class org.apache.xindice.core.MetaSystemCollection extends
//...

Those results contain everything I need in order to have the class imported
into my current file and to get a pop-up menu of accessible method
invocations and fields, including a parameterlist.
--
STH
Hatton's Law: "There is only One inviolable Law"
KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com
Mozilla: http://www.mozilla.org
Jul 22 '05 #1
9 1701
Steven T. Hatton wrote:
This was written for the gnu.g++.help list. It rather clearly spells out [..]


I must be riding my stupid horse today. Could you for my benefit
clearly spell out what is it you're proposing C++ has? I cannot
figure it out from the non-C++ code you posted. Thanks.

V
Jul 22 '05 #2
Victor Bazarov wrote:

Steven T. Hatton wrote:
This was written for the gnu.g++.help list. It rather clearly spells out [..]


I must be riding my stupid horse today.


Nope. I couldn't figure it out, either. A sentence or two describing
what's desired would be helpful.

--

Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)
Jul 22 '05 #3
On Fri, 04 Jun 2004 12:41:08 -0400 in comp.lang.c++, Pete Becker
<pe********@acm.org> wrote,
Victor Bazarov wrote:

Steven T. Hatton wrote:
> This was written for the gnu.g++.help list. It rather clearly spells out [..]


I must be riding my stupid horse today.


Nope. I couldn't figure it out, either. A sentence or two describing
what's desired would be helpful.


He wants to generate library user documentation from the object code.

Jul 22 '05 #4
Victor Bazarov wrote:
Steven T. Hatton wrote:
This was written for the gnu.g++.help list. It rather clearly spells out
[..]


I must be riding my stupid horse today. Could you for my benefit
clearly spell out what is it you're proposing C++ has? I cannot
figure it out from the non-C++ code you posted. Thanks.

V


The bash code was presented to show the implementation of the commands
demonstratedin the following

<original>
If there is a Java class I wish to use in my code, I can put the code listed
above in a file called ~/bin/jq. Source it:
Fri Jun 04 11:45:51:> . jq
</original>

Substitute Java class with C++ class, template, and, since C++ supports
namespace local functions, they too can be considered, as can variables and
constants which are namespace local.

Sourcing a file is a way to introduce symbols and associated values into the
current environment.

<original>
If I know the class contains the substring 'System' I type:
Fri Jun 04 11:45:51:> jpgrep System
org/apache/xml/utils/SystemIDResolver.class
org/apache/xpath/functions/FuncSystemProperty.class
org/apache/xmlrpc/SystemHandler.class
org/apache/xindice/core/MetaSystemCollection.class
org/apache/xindice/core/SystemCollection.class
</original>

I should have written 'class name containst a substring'. Class names in
Java are used in a virtually identical way as they are in C++, with the
exception that there are some requirements that the file containing the
source for most classes have a base name identical to that of the
classname. The part before the basename of the class is the package name
expressed using '/' as a separator. Within the body of the source the
following:

org/apache/xml/utils/SystemIDResolver.class

could be written as:

org.apache.xml.utils.SystemIDResolver

A package is vaugly comperable to a namespace in C++. So the C++
counterpart to the fully qualified class name above would be something
like:

org::apache::xml::utils::SystemIDResolver

There is a mechanism similar to the #include mechanism of the C++
preprocessor which enables me to write:

import org.apache.xml.utils.SystemIDResolver;

in a way comperable to a combination of:

#includ <systemid.h>

and

using org::apache::xml::utils::SystemIDResolver;

in C++.

Since Java's file naming rules require the class to appear in a file with
the same qualified name (relative to some parent directory name) as the
classname, the import serves the same purpose as both the C++ using
declaration, and the #import directive. Java classes are usually contained
in compressed file called jar (Java archive) files, and have a .jar
extension. Therefore org/apache/xml/utils/SystemIDResolver.class is the
name of the file relative to the virtual root of the jar file.

<original>
If I want to see the interfaces for each of these, I enter:
</original>

The concept of interface I intended is that explained in TC++PL(SE). Using
the above explanations, substitute the appropriate symbols to convert the
following output to it's C++ counterpart. For example:

<original>

org/apache/xml/utils/SystemIDResolver.class
Compiled from "SystemIDResolver.java"
public class org.apache.xml.utils.SystemIDResolver extends java.lang.Object{
****public*org.apache.xml.utils.SystemIDResolver() ;
****public*static*java.lang.String*getAbsoluteURI( java.lang.String);
*******throws*javax/xml/transform/TransformerException
****public*static*java.lang.String
getAbsoluteURIFromRelative(java.lang.String);
****public*static*java.lang.String
getAbsoluteURI(java.lang.String,java.lang.String);
*******throws*javax/xml/transform/TransformerException
}

</original>

would convert to:

#include <SystemIDResolver.h>

using org::apache::xml::utils::SystemIDResolver::class

class org::apache::xml::utils::SystemIDResolver extends java::lang::Object{
public:
org::apache::xml::utils::SystemIDResolver();
static java::lang::String getAbsoluteURI(java::lang::String)
throw (javax::xml::transform::TransformerException);
static java::lang::String getAbsoluteURIFromRelative(java::lang::String);
static java::lang::String
getAbsoluteURI(java::lang::String,java::lang::Stri ng)
throw (javax::xml::transform::TransformerException);
}
Those results contain everything I need in order to have the class imported
into my current file and to get a pop-up menu of accessible method
invocations and fields, including a parameterlist.
--
STH
Hatton's Law: "There is only One inviolable Law"
KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com
Mozilla: http://www.mozilla.org
Jul 22 '05 #5
David Harmon wrote:
On Fri, 04 Jun 2004 12:41:08 -0400 in comp.lang.c++, Pete Becker
<pe********@acm.org> wrote,
Victor Bazarov wrote:

Steven T. Hatton wrote:
> This was written for the gnu.g++.help list. It rather clearly spells
> out [..]

I must be riding my stupid horse today.


Nope. I couldn't figure it out, either. A sentence or two describing
what's desired would be helpful.


He wants to generate library user documentation from the object code.


Actually, that's not quite what I want, but close. First off, if I just had
the freakin' headers formatted to reflect the interface (what a concept),
that would be a huge part of the battle. The following is quite common in
C++ headers. It is the <vector> header from gnu. Yes, in this rare
instance I am saying nasty things about gnu.
/** @file vector
* This is a Standard C++ Library header. You should @c #include this
header
* in your programs, rather than any of the "st[dl]_*.h" implementation
files.
*/

#ifndef _CPP_VECTOR
#define _CPP_VECTOR 1

#pragma GCC system_header

#include <bits/functexcept.h>
#include <bits/stl_algobase.h>
#include <bits/stl_alloc.h>
#include <bits/stl_construct.h>
#include <bits/stl_uninitialized.h>
#include <bits/stl_vector.h>
#include <bits/stl_bvector.h>

#ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
# include <bits/vector.tcc>
#endif

#endif /* _CPP_VECTOR */
There is a tool, freely available, which creates very nice C++ api
documentation. http://www.doxygen.org

In a typical Java IDE it is very easy to add libraries, and to have the IDE
query them to find all the symbols available, or potentially available to
the current scope. This means the IDE can do a great deal of the drudge
work of locating symbols within the available libraries, and providing the
necessary code in order to use the symbol. It also makes it possible for
the IDE to verify the code contains valid identifiers, and can mark invalid
code wish some kind of error indicator. The power of such tools is hard to
fully communicate without the audience having experience using them.
--
STH
Hatton's Law: "There is only One inviolable Law"
KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com
Mozilla: http://www.mozilla.org
Jul 22 '05 #6
Steven T. Hatton wrote:
<snip>

In a typical Java IDE it is very easy to add libraries, and to have
the IDE query them to find all the symbols available, or potentially
available to the current scope. This means the IDE can do a great
deal of the drudge work of locating symbols within the available
libraries, and providing the necessary code in order to use the
symbol. It also makes it possible for the IDE to verify the code
contains valid identifiers, and can mark invalid code wish some kind
of error indicator. The power of such tools is hard to fully
communicate without the audience having experience using them.


That's what header files are for. VC++ 2003 has a nice "Class View" pane and
Intellisense that does what you want, I believe. It does not immediatly mark
invalid identifiers, but that's easily told by either compiler diagnostics
or hovering the pointer over the identifier.

- Pete
Jul 22 '05 #7
Petec wrote:
Steven T. Hatton wrote:
<snip>
It also makes it possible for the IDE to verify the code
contains valid identifiers, and can mark invalid code wish some kind
of error indicator. The power of such tools is hard to fully
communicate without the audience having experience using them.
That's what header files are for.


Or so the standard literature would have us believe. The problem I'm seeing
from the Linux end of things is the practice, on the part of the GCC team,
of using macro magic to use the same set of headers, unaltered, for all
platforms. It would be fine if in addition they provided a means to
extract the 'correct' form of the headers. But this is is a better topic
for the GCC list.
VC++ 2003 has a nice "Class View" pane
and Intellisense that does what you want, I believe. It does not
immediatly mark invalid identifiers, but that's easily told by either
compiler diagnostics or hovering the pointer over the identifier.


I know there is, and has been for many years, some level of this kind of
support in both Borland and Microsoft's IDEs. (And if you stand on your
head and play a guitar with your toes, you can get it to work with Emacs.)
I'd have to see what VC++ is doing in order to determine if it's the same
kind of thing I'm seeking. I have VC++ 6.0, but I have not been inclined to
spend much time booted into Chi-Rho.
Here's an incomplete list of functionality I'm thinking of.

Will the IDE add the required headers and using declarations to your source
automatically?

Will it give an indication of the exceptions thrown by a function call?

Will it display all the overloaded function signture with an indication of
the type of parameter it takes?

Does it filter according to context? That is, does it only show the
identifiers visible in the current scope when it provides code completion
(unless you ask for more)?

When it shows error indicators in the edit buffer, is that a result of
compiler output, or is the code evaluated as you input it?

Can you add virtually any SDK such as the Xerces C++ to the available
resources and have the code completion and checking work at the same level
as it does for the Standard Libraray and the implementation's API(s)?

If the answer to all the above is yes, then they are doing much of what I
would like to see in an IDE. I don't want to go too deeply into the
details of any particular IDE on this news group. My purpose is to
understand what limitations, if any, exist to prevent the functionality
from being implemented for C++.

I'm sure it can be done for limited proprietary configurations, but I'm
looking for something that is generally portable, and applicable to all
(development) libraries. It should be a default feature of normal
operation, not requiring any significant effort on the part of the user.

With Java, the way the class files are designed makes the counterpart of
what is found in C++ header files available with all distributions of a
program. I am pretty sure that is not the case with C++. I don't know if
it's even desirable. But a uniform standard specifying how development
libraries can support this kind of functionality would be nice.

My experience with Java verses C++ using such resources as the Xerces C++
code base, KDevelop, Qt, KDE, etc., is that the C++ setup is usually
harder. The separation of compiled output from the headers leads to more
problems as does the way libraries and include files are typically located.
By the compiler and runtime environments.

Something tells me the big players will resist any kind of standardization
of library mechanism for C++. I could be wrong, but, one or two particular
companies might try to retain what they perceive as an advantage by
maintaining incompatability between platforms.

--
STH
Hatton's Law: "There is only One inviolable Law"
KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com
Mozilla: http://www.mozilla.org
Jul 22 '05 #8
Steven T. Hatton wrote:
[...]
Here's an incomplete list of functionality I'm thinking of.
[...]


You're thinking of adding training wheels and tooltips onto a military
aircraft. I think you're missing the point of having the complexity
and flexibility of C++ in the first place. If you need Java or Pascal,
you should keep using Java or Pascal. Those are the Jumbo Jet and the
Cessna of the programming world. Please step off the ladder to the F-18
cockpit, it's dangerous, you can fall off and hurt your head.

Some things you wrote about are available. Some things are too damn
restrictive to be useful. Only paranoid and weak mind can consider that
somebody might be interested in "maintaining incompatibility". That
"incompatibility between platforms" is simply the side effect of trying
to keep things real, backwards compatible, and efficient (all that at the
same time).
Jul 22 '05 #9
Victor Bazarov wrote:
Steven T. Hatton wrote:
[...]
Here's an incomplete list of functionality I'm thinking of.
[...]
You're thinking of adding training wheels and tooltips onto a military
aircraft.


How many years of professional experience do you have with high tech
military equipment? How many custom designed systems have you built for use
by the Joint Chiefs? MarForPac? Joint forces commanders? I suspect you
really don't understand the importance of being able to gain information
quickely and efficiently in a combat situation.
I think you're missing the point of having the complexity
and flexibility of C++ in the first place.
Some of the complexity in C++ adds nothing but inconvenience.
If you need Java or Pascal,
you should keep using Java or Pascal. Those are the Jumbo Jet and the
Cessna of the programming world. Please step off the ladder to the F-18
cockpit, it's dangerous, you can fall off and hurt your head.
Have you every worked with a system that generates 36000 volts? I mean
reaching in the cabinet where that potential is generated, and replacing
the components that generate the voltage. Have you ever taken one of these
on a camping trip?

http://area51specialprojects.com/ima...k/Launcher.jpg
Some things you wrote about are available. Some things are too damn
restrictive to be useful. Only paranoid and weak mind can consider that
somebody might be interested in "maintaining incompatibility".
Is that why Microsoft settled with sun Microsystems for a measly
$1,600,000,000 US?
That
"incompatibility between platforms" is simply the side effect of trying
to keep things real, backwards compatible, and efficient (all that at the
same time).


I started working with Netscape SuiteSpot 1.0 when it was in early Beta. You
proabably don't appreciate the signifigance of that statement. But trust
me, there is irony here.

--
STH
Hatton's Law: "There is only One inviolable Law"
KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com
Mozilla: http://www.mozilla.org
Jul 22 '05 #10

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

Similar topics

11
by: Alexei Polkhanov | last post by:
Hello everybody! I was looking for PDf version of ISO C++ standard on several websites and I found few documents. one here: http://www.techstreet.com/cgi-bin/detail?product_id=49964 and it is...
0
by: Steven T. Hatton | last post by:
I read some comments regarding the quality of binding of the C++ Standard stating that the book is poorly bound, and likely to fall apart. I was thinking about buying it because I find it easier...
9
by: Alok | last post by:
Hi, I want to purchase the ISO C++ standard ISO/IEC 14882:2003 specification for reference. The ANSI store sells the PDF or CD-ROM of the document for $30...
2
by: murali.desikan | last post by:
Hi, ISO/IEC 14882:2003 Section 3.4.1/13 has the following Names declared in the outermost block of the function definition are not found when looked up in the scope of a handler for the...
11
by: ManicQin | last post by:
Hi, I was about to buy the Standard but then I found this link http://www.usatlas.bnl.gov/~dladams/cpp/INCITS+ISO+IEC+14882-2003.pdf Hmmmm... ... The link seems legit so ... what gives? ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.