473,566 Members | 3,342 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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*.c lass$*|*grep*$1 )
********for*c*i n*$h;do
*************ec ho*$c;
********done
****done*
}

function jif() {
****for*j*in*${ CLASSPATH//:/'*'};*do
********h="";
********h=$(jar *-tf*$j*|*grep*.c lass$*|*grep*$1 )
********for*c*i n*$h;do
************tes t*-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/SystemIDResolve r.class
org/apache/xpath/functions/FuncSystemPrope rty.class
org/apache/xmlrpc/SystemHandler.c lass
org/apache/xindice/core/MetaSystemColle ction.class
org/apache/xindice/core/SystemCollectio n.class

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

org/apache/xml/utils/SystemIDResolve r.class
Compiled from "SystemIDResolv er.java"
public class org.apache.xml. utils.SystemIDR esolver extends java.lang.Objec t{
****public*org. apache.xml.util s.SystemIDResol ver();
****public*stat ic*java.lang.St ring*getAbsolut eURI(java.lang. String);
*******throws*j avax/xml/transform/TransformerExce ption
****public*stat ic*java.lang.St ring
getAbsoluteURIF romRelative(jav a.lang.String);
****public*stat ic*java.lang.St ring
getAbsoluteURI( java.lang.Strin g,java.lang.Str ing);
*******throws*j avax/xml/transform/TransformerExce ption
}

org/apache/xpath/functions/FuncSystemPrope rty.class
Compiled from "FuncSystemProp erty.java"
//...
}

org/apache/xmlrpc/SystemHandler.c lass
Compiled from "SystemHandler. java"
public class org.apache.xmlr pc.SystemHandle r extends java.lang.Objec t
implements org.apache.xmlr pc.ContextXmlR
//..
execute(java.la ng.String,java. util.Vector,org .apache.xmlrpc. XmlRpcContext);
*******throws*j ava/lang/Exception
}

org/apache/xindice/core/MetaSystemColle ction.class
Compiled from "MetaSystemColl ection.java"
public final class org.apache.xind ice.core.MetaSy stemCollection 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 1716
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/SystemIDResolve r.class
org/apache/xpath/functions/FuncSystemPrope rty.class
org/apache/xmlrpc/SystemHandler.c lass
org/apache/xindice/core/MetaSystemColle ction.class
org/apache/xindice/core/SystemCollectio n.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/SystemIDResolve r.class

could be written as:

org.apache.xml. utils.SystemIDR esolver

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::xm l::utils::Syste mIDResolver

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

import org.apache.xml. utils.SystemIDR esolver;

in a way comperable to a combination of:

#includ <systemid.h>

and

using org::apache::xm l::utils::Syste mIDResolver;

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/SystemIDResolve r.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/SystemIDResolve r.class
Compiled from "SystemIDResolv er.java"
public class org.apache.xml. utils.SystemIDR esolver extends java.lang.Objec t{
****public*org. apache.xml.util s.SystemIDResol ver();
****public*stat ic*java.lang.St ring*getAbsolut eURI(java.lang. String);
*******throws*j avax/xml/transform/TransformerExce ption
****public*stat ic*java.lang.St ring
getAbsoluteURIF romRelative(jav a.lang.String);
****public*stat ic*java.lang.St ring
getAbsoluteURI( java.lang.Strin g,java.lang.Str ing);
*******throws*j avax/xml/transform/TransformerExce ption
}

</original>

would convert to:

#include <SystemIDResolv er.h>

using org::apache::xm l::utils::Syste mIDResolver::cl ass

class org::apache::xm l::utils::Syste mIDResolver extends java::lang::Obj ect{
public:
org::apache::xm l::utils::Syste mIDResolver();
static java::lang::Str ing getAbsoluteURI( java::lang::Str ing)
throw (javax::xml::tr ansform::Transf ormerException) ;
static java::lang::Str ing getAbsoluteURIF romRelative(jav a::lang::String );
static java::lang::Str ing
getAbsoluteURI( java::lang::Str ing,java::lang: :String)
throw (javax::xml::tr ansform::Transf ormerException) ;
}
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_uninitializ ed.h>
#include <bits/stl_vector.h>
#include <bits/stl_bvector.h>

#ifdef _GLIBCPP_NO_TEM PLATE_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 "maintainin g incompatibility ". That
"incompatibilit y 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 "maintainin g incompatibility ".
Is that why Microsoft settled with sun Microsystems for a measly
$1,600,000,000 US?
That
"incompatibilit y 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
2748
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 named "INCITS-Adopted ISO/IEC Standard" and it tells me that this version of standard was replaced by another review from year 2003. I have my copy I...
0
1166
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 to read hardcopy than on-screen. I have the language specification portion of the Standard printed 2 pages per face in book form, and bound using...
9
2641
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 http://webstore.ansi.org/ansidocstore/product.asp?sku=INCITS%2FISO%2FIEC+14882-2003, but the ISO store sells the seemingly same document for CHF 352 ( or over $281.82 ...
2
1537
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 function-try-block.
11
2218
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? Thanks...
0
7673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7584
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8109
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7645
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7953
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6263
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1202
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.