IWETHEY v. 0.3.0 | TODO
1,095 registered users | 1 active user | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Re: There is NOTHING wrong with pointers!
I didn't say that. Key word in the phrase "Byzantine pointer usage" is "usage".

But for you to make a remark like that is so unlike you so as to make me believe that your login has been copped by someone else.
Alternate possibility: you have misunderstood what I said. Occam's Razor... In point of fact, however, the notation used for manipulating pointers in C is in fact Byzantine. cf. my previous comment about dealing with other people's stupidities.

However, I will note that Java *does* use pointers, as they should be used. Every object reference is a pointer. Can you do "pointer arithmetic" on them? No. Why would I need or want to, in the work that I do? Java gives you just as much control over what happens to the data (pass the reference if you want someone to be able to modify it, or pass a clone if not), just in a different manner.

I wouldn't want to write an OS in such a language.
Neither would I. But I sure as hell wouldn't want to write business logic in C++, either. Actually, if I were using an OO C language to write an OS, I'd use Objective C because it's a cleaner, more powerful object model than C++. See Todd for details if you have questions with that. I have no issues with C's ability to get down and dirty. I do have issues with the graft of OO that is called C++.

Basic point (again): C++ requires to much damn thought and code that could better be spent solving actual problems, instead of those created by the compiler.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Re: There is NOTHING wrong with pointers!
This argument reminds me of a project I was working on back in college (those were the days, right?). I was manipulating a structure in memory directly from disk. The structure was just a bunch of pointers that mapped to the data when it was read it IIRC. Anyway, some of those pointers were to bytes, I believe. We were doing most of our coding (it was me and another guy doing the coding) on Intel boxes, and it was working fine. However, when we tried to run on the unix boxes (I believe they were HP boxes, but I'm not sure), we'd core all the time. It turned out that byte-referencing using pointers works fine on Intel, but doesn't work well on certain unix boxes (because of the way word boundaries are handled). Or something like that.

Anyway, the point was that because of our use of pointers to direct memory, we weren't cross platform (not sure if it was an operating system issue or a hardware issue, though I believe it had to do with the way the CPU handled memory access). We had to basically rewrite how we handled the situation (I think we got away with it by just reordering the structure, but I don't remember exactly).

It never would have been a problem in Java or another language that didn't deal with memory directly (using references). Of course, I don't remember it being that difficult to get around once I'd figured out the problem, anyway.

Dan
New Cross-platform can be nasty.
Which is what I'm involved in right now with C++.

Cross-platform issues:

1) endian problems
2) word boundaries (ask me about -malign-double sometime, *sigh*)
3) C++ differences between compilers (STL, mangling, pickiness, etc.)
4) Signals, threading, select, non-blocking sockets, etc.
5) all the other little things I've fixed that I've forgotten

Note that only #3 is specific to C++. But #3 is an ongoing, huge issue in my porting efforts.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Er,...really?
It never would have been a problem in Java or another language that didn't deal with memory directly (using references).

Actually it would have.

As Scott points out, Java "references" are really pointers, probably "smart pointers", with the inard hidden to protect the illiterati. A "Reference" in Java would have had the same problem that pointers in C++ had. The problem was the memory model; your Intel box used 16-bit code, and a small pointer model, allowing for 16-bit pointers. Your 'nix box used a 32-bit pointer model, which was incompatible with the 16-bit poitners stored in your file. (I am assuming that you did not try to read pointers generated on the Intel system with your 'nix system, or vice versa....) If your 'nix box were to have been an Intel device, and your 'nix supported small pointer models, your code would probably have worked just fine.
jb4
"They lead. They don't manage. The carrot always wins over the stick. Ask your horse. You can lead your horse to water, but you can't manage him to drink."
Richard Kerr, United Technologies Corporation, 1990
New Java pointer problems
Not that I really want to jump into the fray....
A "Reference" in Java would have had the same problem that pointers in C++ had.
Java code is compiled into a common bytecode for all machines - not compiled per machine. The JVM is the machine that is running the compiled code - not the underlying cpu. Assuming the VM implementor took care of their business, the differences in hardware and OS are abstracted away from the programming chore. You don't program Java for Sparc, Risc, or Intel CPUs - you program them to the Java Virtual Machine.

Not that this is always perfect. Sometimes the Java specs are ragged around the edges - for example threading has quite different results on the various OS's. Also, there's the problem that the JVM is not optimized for any particular cpu, making the code unoptimized.
New OT: threading
Threading variations are probably more a result of the underlying thread library than the Java spec.

As an example, Linux posix threads use a single process per thread, which means that each thread also gets a different pid (via getpid()). Even worse, the signal handling gets all screwed up, and you can't task a single thread to receive signals for all the threads in a process (which is how you should do it).

The Solaris and Win32 thread libraries do not have these problems.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Just a nit
Just a quick nit... The JVM *can* be optimized for the particular OS/hardware. There's nothing that prevents it (I think what you meant was that the bytecode couldn't be optimized for a particular hardware/OS...which is true, but isn't particularly interesting, as it can be modified on the fly and be optimized for a particular hardware CPU, etc.). And the optimization can be done at runtime, which (in some cases) can be faster than a compiled optimization. Remember, I said "can."

Dan
New Re: There is NOTHING wrong with pointers!
Basic point (again): C++ requires to much damn thought and code that could better be spent solving actual problems, instead of those created by the compiler.

Yep, that's pretty much it. C++ is useless except as a better C, and C is not good as an application language. It's good for writing things that are fast and accurate.

BTW I don't see anything really complex about malloc and free. You decide how much memory is needed, get it, give it back.

The main problem with malloc is heap contention when it's happening in independent threads. This kind of problem shouldn't show up at the application or even the library level - the OS should handle it. It's proof that C is still a systems language.
-drl
New Re: There is NOTHING wrong with pointers!
malloc, free, new, delete... the initial discussion was about C++, which inherited C's memory management and slathered on its own layer as well. Who owns the memory is a problem as well (this is a big issue with the Xerces library). There are a lot of things to track when you are dealing with code from more than one person, and the complexity multiplies from there.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New I guess I don't see the problems with the compiler
However, I will note that Java *does* use pointers, as they should be used. Every object reference is a pointer. Can you do "pointer arithmetic" on them? No. Why would I need or want to, in the work that I do?

I dunno. But then, if you don't need to do pointer arithmetic in the work that you do, why, then, would you try to do any? There is nothing in the language that compels you to do pointer arithmetic at random intervals in your code....

So you can't do pointer arithmetic in Java. OK, then...as I am not a Java expert, I must ask: How do you interate through a list of sequentially organized objects? Is there an STL-like collection for references to objects of like type, in which an interator object is defined? What about the indeterminately sized array of char, that C people refer to as a string? How is that interated? (I know there is a String object in Java, but it is not as lightweight as a C null-terminated string, in spite of what its proponents claim.)
Basic point (again): C++ requires to much damn thought and code that could better be spent solving actual problems, instead of those created by the compiler.

Without trying to be pedantic, I assume you mean problems created by the language. Quite honestly, I don't see such problems at all. Perhaps I am more comfortable with the wild-and-wooly nature of C++ than you are; you might prefer the more politically-correct, Father-knows-best approach that Java provides. That's OK with me. (I was raised in part in New Mexico; wild-and-wooly is par for the course there). And sure, cleaning up after a hack is no fun (although it can be rather lucrative...). I personally don't see that Java is not without its own "problems with the language". One that comes to mind is the handling of exceptions; it is pedantic to require the caller of a function that can raise an exception to handle all exceptions that that called function can produce. I'm also not real pleased with the stick-both-definition-and-declaration-of-everything-in-one-file nonsense; makes for real unreadable code (the most unreadable code I've seen in recent history was the code that was presented in a Java seminar at COMDEX that was supposed to be an example of how to write good code!).

And then, there's Swing, and the other User Interfaces du jour that make trying to get anthing out of Java such a joy.

I'm sure I can come up with several dozen other "problems with the language" once I becmore more familiar with it. In fact, I'll probably be able to match you problem for problem. C++ ain't the greatest thing ever evented in the name of computer science, but it ain't the devil's spawn either. The same can be said for Java. It's a tool. You learn to use a tool. I can be really dangerous with a powersaw, too, but that's because I don't know how to use one real well (coupled with the fact that I don't ususally have the patience to work with it like I should). Perhaps you're dangerous with C++ for the same reasons?
jb4
"They lead. They don't manage. The carrot always wins over the stick. Ask your horse. You can lead your horse to water, but you can't manage him to drink."
Richard Kerr, United Technologies Corporation, 1990
New Hmmmm - seems this thread got derailed due to ...

lack of understanding of what the core issue is.

Perhaps we can level set ...

- For writing business logic, a task that should be carried out by programmers with some understanding of the domain they are programming for, languages that remove programming complexity are beneficial in terms of producing business solutions.

- For writing efficient system code, a task that should be carried out by programmers with technical expertise in a system domain, languages that provide efficiency with minimal complexity are beneficial.

Java is *not* an ideal systems language. C++ can be. C++ compared to Java, is best written by programmers who are disciplined and who have excellent awareness of the underlying physical technologies.

Perhaps this gets us to a place we can agree/disagree more coherently.

Cheers Doug

New Java isn't a systems language at all, IMO.
C++ can be, if everyone on the team is an excellent C++ programmer. Team programming with C++ (like Perl) can be a nightmare.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New I sure wouldn't use Java for Systems work

I would tend toward C/C++ but if the task is a very simple one and the data volume not large, I might use any old language, even MF COBOL <g>.

Cheers Doug
New Which brings up the point: what IS systems work
Is it something that involves working with the system at a low level? And what does that mean, exactly?

Example: we have a program that collects up various pieces of the environment and runs a Java program with the appropriate classpath and so forth (we have multiple environments; depending on setting CLASSPATH is unreliable). For various reasons, I was tasked to write this in C++. The resulting 130+ line program could have been done more easily, quickly, and in a more maintainable fashion in Perl or even shell script.

So what is "systems" programming? :-)
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New The other aspect is...
...that a project of substantial size and complexity involves a lot of different aspects. Some of those involve low level details, while others involve domain specific abstractions. The choice of any one language to fit a project involves tradeoffs where the language that will be great for one part of the project will be a burden on the other edges.

New Stroustrup has a great quote about that:
"For every single specific question, you can construct a language or system that is a better answer than C++. C++'s strength comes from being a good answer to many questions rather than being the best answer to one specific question....Thus, the most a general-purpose language can hope for is to be 'everybody's second choice'"
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Which is why C/C++ can be easily integrated with anything
We use TCL on the edges. Define a few extra commands, and your analysts are in business. Java can do it too, but only through rather awkward C API. In fact, C is indeed the lingua franca of code interoperability.
--

We have only 2 things to worry about: That
things will never get back to normal, and that they already have.
New *C* is the lingua franca.
C++ is a nightmare of incompatibility across platforms and compilers. gcc 3.2.1 has made a few steps in a better direction with their adherence to the new ABI, but try using a Forte-compiled 3rd party library (like, say, Purify) with a different compiler.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New ObjectiveC++
The ObjectiveC extensions have now been implemented in the gcc's c++ compiler.

Why? So you can call C++ code seamlessly from Objective C code. Its got its uses.



I think that it's extraordinarily important that we in computer science keep fun in computing. When it started out, it was an awful lot of fun. Of course, the paying customer got shafted every now and then, and after a while we began to take their complaints seriously. We began to feel as if we really were responsible for the successful, error-free perfect use of these machines. I don't think we are. I think we're responsible for stretching them, setting them off in new directions, and keeping fun in the house. I hope the field of computer science never loses its sense of fun. Above all, I hope we don't become missionaries. Don't feel as if you're Bible salesmen. The world has too many of those already. What you know about computing other people will learn. Don't feel as if the key to successful computing is only in your hands. What's in your hands, I think and hope, is intelligence: the ability to see the machine as more than when you were first led up to it, that you can make it more.

--Alan Perlis
New Welcom to my nightmare!
C++ is a nightmare of incompatibility across platforms and compilers.


Errr?

Any C or C++ compiler that adheres to the ANSI/ISO standards belies that claim. Most C++ compilers since 1997 are ANSI compliant...with the notable exception of any GNU compiler before 3.0, and any Microsift compiler (regardless of version number). So, once again, i don't understand where the basis for that claim comes from (unless you're saddled with an ancient compiler, in which case, I totally agree!).

And BTW, what is ABI?
jb4
"They lead. They don't manage. The carrot always wins over the stick. Ask your horse. You can lead your horse to water, but you can't manage him to drink."
Richard Kerr, United Technologies Corporation, 1990
New ABI: Application Binary Interface
It's the bit that directs how C++ names are mangled. Find me two C++ compilers that use the same ABI and then we'll talk about compatibility. The ABI is different across gcc 2.95, 2.96, 3.0, 3.1, and 3.2. It's different for Forte. It's different for Intel. It's different for any compiler you care to name.

with the notable exception of any GNU compiler before 3.0, and any Microsift compiler
Well goll-ee gee whillikers, shoot me in the head for having to use MSVC 6 and gcc 2.95.X. I guess that's my fault. All I have to do is buy a $700 C++ compiler instead of using the one that comes with my platforms, and everything is A-OK!

We're using gcc 2.95.2 on Solaris, gcc 2.95.4 on Linux, and MSVC on Windows. We've tried using Forte; the porting effort was fairly major. We've tried using gcc 3.x. The porting effort was fairly major. I'm looking at Intel C++ 7.0; I've gotten through one of our modules and already the porting effort is looking to be fairly major.

So while theoretically ANSI standards would dictate that porting would be terrifically easy, the reality (at least with the code base I'm on; cf. discussion about protecting against other people's stupidity) is that it's a nightmare. I've got about 800K lines of C++ code alone to port... and I'm not having too much fun.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New I used to think Direct To SOM compilers would fix this
The efficiencey freaks refused to use or adopt it.

MS compiles everything to COM - which does kind of the same thing.

Stroustrup's name mangling scheme was a really bad idea and its made C++ a bad citizen on the OS. Prior to C++ it was easy to mix compiled libs written in C, Fortran, Pascal, whatever, in the same program. C++'s "link mechanism" broke that.

Some people just shouldn't design languages.

Gosling and Stroustrup are two notable examples of smart guys with no talent for the task.



I think that it's extraordinarily important that we in computer science keep fun in computing. When it started out, it was an awful lot of fun. Of course, the paying customer got shafted every now and then, and after a while we began to take their complaints seriously. We began to feel as if we really were responsible for the successful, error-free perfect use of these machines. I don't think we are. I think we're responsible for stretching them, setting them off in new directions, and keeping fun in the house. I hope the field of computer science never loses its sense of fun. Above all, I hope we don't become missionaries. Don't feel as if you're Bible salesmen. The world has too many of those already. What you know about computing other people will learn. Don't feel as if the key to successful computing is only in your hands. What's in your hands, I think and hope, is intelligence: the ability to see the machine as more than when you were first led up to it, that you can make it more.

--Alan Perlis
New Some progress has been made.
There's a new ABI on 32-bit Linux that gcc 3.2 is targetting. Supposedly, other compilers on the platform are targetting it as well. The only one I've found actually claiming this is Intel's compiler, and they're actually targetting "gcc compatibility", not "standard ABI compatibility".

Regardless, by their own documentation, they aren't there quite yet.

What year is it again?
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Snide remark and a question
First the snide remark: So you'd want to be able to compile some of your program in Sun's Java, some in J Builder, and some in Visual J++, and have them all work together? Yeah, right.

Now the question: What exactly is your porting problem. Is it that you're trying to link modules compiled by different compilers? Is it that the code itself is so non-standard that compiler B will not compile what Compiler A compiles? Is it that the associated libraries are so different that even well-formed C++ won't "compile" because the library calls are non-existant?
jb4
"They lead. They don't manage. The carrot always wins over the stick. Ask your horse. You can lead your horse to water, but you can't manage him to drink."
Richard Kerr, United Technologies Corporation, 1990
New Snide response.
First the snide remark: So you'd want to be able to compile some of your program in Sun's Java, some in J Builder, and some in Visual J++, and have them all work together? Yeah, right.
Yes, actually, I've done exactly that with no issues whatsoever. The Java code we have here compiles flawlessly across all three platforms. I've never had issues porting Java code.

My porting problem is that
  1. portions of the code may or may not be nonstandard. cf, for the THIRD or FOURTH time, this is not my code. I don't care if you are lucky enough to be able to control your code 100%; I don't have that luxury. I've believe I've made that point several times.
  2. the compilers may or may not compile the same code whether it is standard or not.
  3. Even when the compilers DO compile the code, it isn't always compiled correctly. gcc 3.2.1 forgets about #defines. gcc 2.95.2 has broken exception handling when throwing exceptions in shared libs. MSVC has a broken STL implementation. Now I'm trying another C++ compiler, Intel's. See other thread for new issues arising from that.
The list goes on and on. Standards will technically give compatibility; in the real world that seems not to be the case.

All of this is beside the inherent stupidities of the C++ language itself.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Libraries - remember those?
So you'd want to be able to compile some of your program in Sun's Java, some in J Builder, and some in Visual J++, and have them all work together? Yeah, right.

But this does work. The binary format of java classes is strictly defined. Unlike the binary format of C++ "objects" or the name mangling schemes.

People get jar files (java's version of a library) all the time. It doesn't matter if they're compiled with jikes or sun's java compiler, they all work. C++ was the first language to toss binary interoperability out the window.



I think that it's extraordinarily important that we in computer science keep fun in computing. When it started out, it was an awful lot of fun. Of course, the paying customer got shafted every now and then, and after a while we began to take their complaints seriously. We began to feel as if we really were responsible for the successful, error-free perfect use of these machines. I don't think we are. I think we're responsible for stretching them, setting them off in new directions, and keeping fun in the house. I hope the field of computer science never loses its sense of fun. Above all, I hope we don't become missionaries. Don't feel as if you're Bible salesmen. The world has too many of those already. What you know about computing other people will learn. Don't feel as if the key to successful computing is only in your hands. What's in your hands, I think and hope, is intelligence: the ability to see the machine as more than when you were first led up to it, that you can make it more.

--Alan Perlis
New Exactly.
C, Fortran, whatever... pretty much anything OTHER than C++ that creates a .so will all work together.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Reality check: why libraries matter:
I have STLPort compiled under gcc 2.95.2.

I want to use it under the Intel compiler to test the bug I noted in the other thread. However, because of the name mangling, I can't do that: I have to recompile the library under the Intel compiler now. And once I've done that, I won't be able to use it with gcc any longer.

*grumble*
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Libraries - remember those?
So you'd want to be able to compile some of your program in Sun's Java, some in J Builder, and some in Visual J++, and have them all work together? Yeah, right.

But this does work. The binary format of java classes is strictly defined. Unlike the binary format of C++ "objects" or the name mangling schemes.

People get jar files (java's version of a library) all the time. It doesn't matter if they're compiled with jikes or sun's java compiler, they all work. C++ was the first language to toss binary interoperability out the window.



I think that it's extraordinarily important that we in computer science keep fun in computing. When it started out, it was an awful lot of fun. Of course, the paying customer got shafted every now and then, and after a while we began to take their complaints seriously. We began to feel as if we really were responsible for the successful, error-free perfect use of these machines. I don't think we are. I think we're responsible for stretching them, setting them off in new directions, and keeping fun in the house. I hope the field of computer science never loses its sense of fun. Above all, I hope we don't become missionaries. Don't feel as if you're Bible salesmen. The world has too many of those already. What you know about computing other people will learn. Don't feel as if the key to successful computing is only in your hands. What's in your hands, I think and hope, is intelligence: the ability to see the machine as more than when you were first led up to it, that you can make it more.

--Alan Perlis
New a day late and a dollar short...but extern "C"
wouldn't using extern "C" on modules solve the name-mangling?
New For a 3rd party module? No.
C++ can be made less insane if you control all the pieces. But most 3rd party libraries on Solaris are compiled in Forte... if you don't use Forte, you're screwed.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New If you export C++ mangled functions, you're screwed.
Any sane library developer should use 'extern "C"' to export functions. It's painful, but it works.
--

We have only 2 things to worry about: That
things will never get back to normal, and that they already have.
New Or, rather: Export C++ mangled functions in a lib you sell..
...and your CUSTOMERS are screwed. :-(


   [link|mailto:MyUserId@MyISP.CountryCode|Christian R. Conrad]
(I live in Finland, and my e-mail in-box is at the Saunalahti company.)
Your lies are of Microsoftian Scale and boring to boot. Your 'depression' may be the closest you ever come to recognizing truth: you have no 'inferiority complex', you are inferior - and something inside you recognizes this. - [link|http://z.iwethey.org/forums/render/content/show?contentid=71575|Ashton Brown]
New Simple
Systems programming is any type of programming that impacts aspects of the host system beyond the explicitly published interfaces available to the programmer. So if your fscking with memory, diddling the hardware, programmatically being a DBA, you're doing systems programming.

This issue didn't really arise until 1) C became popular because that's what came with UNIX 2) everyone became a systems programmer when they all had their own systems. Windows and Linux have both made things worse because 1) Windows is a terrible OS design that makes it impossible NOT to do systems programming 2) Linux is UNIX and like it or not, the Linux user is a systems administrator.

Memory management should not be an issue beyond a well-defined barrier. Unfortunately the OSes in common use don't have that barrier.

Could be that Java accidentally became popular because it brings along its own pseudo-OS in the form of the VM. Sort of a shitty solution when the VM is just a process in the same sucky OS. But, if the OS were VM based at the bottom, it would work.
-drl
New No
But SNMP poller that has to poll millions of objects on tens of thousands of targets is. C++ may suck at string manipulation (even that can be remedied with good libraries (not STL)). But, in the hands of a good programmer, it's a sharp tool. Much like Java, C++ is what you make of it. Want garbage collection? Use a library. Want super-fast memory allocation, pre-sorted according to chunk size? Use another library. The fact that Java has library built into the language does not make it unique or particularly good.
--

We have only 2 things to worry about: That
things will never get back to normal, and that they already have.
New But, in the hands of a good programmer, it's a sharp tool.
And as the number of pairs of hands increases, the opportunities for screwing things up increases as well. Not that I'm disputing your example of a good place to use C++.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Like Cathie Ryan said...
"it's not that hard to operate on a patient with AIDS - you just have to be careful and limit the number of hands in the operating field"
--

We have only 2 things to worry about: That
things will never get back to normal, and that they already have.
New Friend of a Friend
works in Apple's security group. Mac OS X makes use of some encryption algos known as elliptical algorithms. I don't know too much about it but he tells me they use C++ to do the algos - but its not OO programming - its ADT programming and its a fairly simple and well defined piece of capability. Encrypt/Decrypt with a key. They get good speed relative to their size expense - much of this is due to aggressive use of inlining.

So there's a good domain for C++.



I think that it's extraordinarily important that we in computer science keep fun in computing. When it started out, it was an awful lot of fun. Of course, the paying customer got shafted every now and then, and after a while we began to take their complaints seriously. We began to feel as if we really were responsible for the successful, error-free perfect use of these machines. I don't think we are. I think we're responsible for stretching them, setting them off in new directions, and keeping fun in the house. I hope the field of computer science never loses its sense of fun. Above all, I hope we don't become missionaries. Don't feel as if you're Bible salesmen. The world has too many of those already. What you know about computing other people will learn. Don't feel as if the key to successful computing is only in your hands. What's in your hands, I think and hope, is intelligence: the ability to see the machine as more than when you were first led up to it, that you can make it more.

--Alan Perlis
New Re: I guess I don't see the problems with the compiler
I dunno. But then, if you don't need to do pointer arithmetic in the work that you do, why, then, would you try to do any? There is nothing in the language that compels you to do pointer arithmetic at random intervals in your code....
To bring up a point raised before, namely the use of autopointers... have they fixed the problem with using autopointers and the STL yet? I don't think so, and in fact I had to fix an issue related to that the other day.

How do you interate through a list of sequentially organized objects?
Use a List and an Iterator object. Java Iterators, unlike C++ iterators (and Java Enumerations, incidentally), are safe from side-effects as well.

Is there an STL-like collection for references to objects of like type, in which an interator object is defined?
Yes. Actually the Java collections can hold objects of any type. How do you iterate through a list of arbitrary, unrelated objects in C++? And how do you deal with the problems of equality vs. equivalence, which are handled explicitly in the Java collections?

What about the indeterminately sized array of char, that C people refer to as a string? How is that interated?
What about it? There's the String class (for constant strings) and the StringBuffer if you want to change it after you've created it. As for "lightweight", it's pretty much the same thing, internally: an array of bytes. What you're thinking of from the "proponents" is probably the fact that when you create a new String from an old one, through 'substring()' or the like, the new String instance shares the old byte array and simply uses a different begin and end index.

Without trying to be pedantic, I assume you mean problems created by the language.
Point noted, and it is an important one. (what do you mean, 'without trying to be pedantic'... in THIS crowd?? ;-) Speaking of pedantic, it's "iterator", not "interator"... ;-)

Perhaps I am more comfortable with the wild-and-wooly nature of C++ than you are; you might prefer the more politically-correct, Father-knows-best approach that Java provides. That's OK with me.
Please. [link|http://web.archive.org/web/20011116015209/http://w3.one.net/~jweirich/oostuff/awk.html|Give] [link|http://web.archive.org/web/20011116015209/http://w3.one.net/~jweirich/oostuff/psout.txt|me] [link|http://web.archive.org/web/20011116015209/http://w3.one.net/~jweirich/oostuff/dosbatch.html|a] [link|http://web.archive.org/web/20011116015209/http://w3.one.net/~jweirich/oostuff/sed.html|break]. I'm probably going to Hell for using some of the languages for OO programming that I have. Java is no more or less "wild and wooly" than C++... in some cases it is more so than C++ (think runtime loading of classes that just arrived over the wire as binary data).

I personally don't see that Java is not without its own "problems with the language".
I explicitly said that it wasn't in my original post. I said that it sucks less than C++. ;-) In fact I'll list a few for you: proliferating libraries du jour, base types aren't fully objects, and a tendency to sell Java as the cure-all for everything from code bloat to Grandma's bunions.

One that comes to mind is the handling of exceptions; it is pedantic to require the caller of a function that can raise an exception to handle all exceptions that that called function can produce.
And in my opinion it's bad practice not to explicitly catch them all.

I'm also not real pleased with the stick-both-definition-and-declaration-of-everything-in-one-file nonsense; makes for real unreadable code
Your opinion; that style was created explicitly to get rid of the stupid .h file proliferation you see in C++. I think it's asinine to have to have tons of crap all declared in the same .h file AND in the .cpp files. The Java hierarchical package system is one of the better points for the language, IMO. It helps with organizing and packaging things.

And then, there's Swing, and the other User Interfaces du jour that make trying to get anthing out of Java such a joy.
Are we talking about libraries, or the language itself now...?

I'm sure I can come up with several dozen other "problems with the language" once I becmore more familiar with it.
And I'm sure I can with C++ as well. ;-)

In fact, I'll probably be able to match you problem for problem.
Or handwave them away with "that isn't a problem for me"...? ;-)

Perhaps you're dangerous with C++ for the same reasons?
Who said I was dangerous? I've been talking about other people's code and what a pain-in-the-ass it is to work with... And this stuff was written by intelligent people (one of whom did his own port of STL to gcc 2.95.2). It's like perl: great if you're working on it by yourself, but horrible once you start to bring other people into the same code base; this sort of overly, needlessly complex crud kills large development efforts. Java protects me from other people's stupidity.

And how about that wacky template debugging fun? Whew, and we thought C-compiler error messages were incomprehensible... ;-) That's not to say that templates don't have their advantages. However, IMO the disadvantages far outweigh them.

C++ was developed as a hacked on preprocessor to C. The world has moved on to develop better object oriented C implementations since then. Unfortunately the world also runs on the "good is enough, better is worse" principle as well.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New OK, here's where we agree to disagree, and agree to agree...
Point noted, and it is an important one. (what do you mean, 'without trying to be pedantic'... in THIS crowd?? ;-) Speaking of pedantic, it's "iterator", not "interator"... ;-)

Yeah, I know. Just tell my hands...and wait till I get used to this goofy Compaq keypad...;-)

One that comes to mind is the handling of exceptions; it is pedantic to require the caller of a function that can raise an exception to handle all exceptions that that called function can produce.

And in my opinion it's bad practice not to explicitly catch them all.

What, to simply pass them on to the next higher level, because you know there is a higher level function that is designed to handle those specific exceptions? The trouble with panaceas, IMnsHO is that they dont take into the account the details of the situation...you know, like when all you have is a hammer, everything looks like a nail? (Or my new favorite," When all you have is FrontPage, everything looks like a web server".)

I'm sure I can come up with several dozen other "problems with the language" once I becmore more familiar with it
.
And I'm sure I can with C++ as well. ;-)

Which would become a waste of both our times. What say we simply agree that both languages have their strengths and weaknesses, and neither are optimally suited for everything?
Or handwave them away with "that isn't a problem for me"...? ;-)

What?!? When did I become Marlowe? ;-)
Who said I was dangerous? I've been talking about other people's code and what a pain-in-the-ass it is to work with... And this stuff was written by intelligent people (one of whom did his own port of STL to gcc 2.95.2). It's like perl: great if you're working on it by yourself, but horrible once you start to bring other people into the same code base; this sort of overly, needlessly complex crud kills large development efforts. Java protects me from other people's stupidity.

I agree that working with other people's code is a pain. I said that earlier. I don't agree that Java, or any other language protects one from other people's stupidity. I feel that way about Java especially, because every example of Java code I've seen has been an incomprehensible jumble, including the stuff that is supposed to be "really good stuff". It is my opinion that Java itself lends itself to this, because of its pile-everything-into-the-same-file approach to writing. But nobody, and I mean nobody (present company excluded) gives two shits about the readibility of the code they write. so I think here we can agree, and disagree simultaneously.
C++ was developed as a hacked on preprocessor to C. The world has moved on to develop better object oriented C implementations since then. Unfortunately the world also runs on the "good is enough, better is worse" principle as well.

This I 100% agree with. And I'd like to see Objective C sometime, to see what all the hoopla is all about. But I doubt you'd disagree that someone who can make a complete mess of a C++ source file can (and generally will) make an equal mess of an Objective C source file, or a Java source file as well, for that matter.
jb4
"They lead. They don't manage. The carrot always wins over the stick. Ask your horse. You can lead your horse to water, but you can't manage him to drink."
Richard Kerr, United Technologies Corporation, 1990
New Re: OK, here's where we agree to disagree, and agree to agre
What, to simply pass them on to the next higher level, because you know there is a higher level function that is designed to handle those specific exceptions?
To explicitly note that you are passing that exception up. In case in the future your method gets called by a different method than the one you were assuming would catch it. Implicit code will always bite you given enough time.

Which would become a waste of both our times. What say we simply agree that both languages have their strengths and weaknesses, and neither are optimally suited for everything?
Except that I've never seen such a comparison ever come to anything other than "Java fixes this stuff in C++. Answer: yeah, but Java is slow," a response which says nothing about the problems pointed out in C++. As Ashton likes to say, "Now we know what your opinions of Java are. Can we talk about C++?".

I said that earlier. I don't agree that Java, or any other language protects one from other people's stupidity. I feel that way about Java especially, because every example of Java code I've seen has been an incomprehensible jumble, including the stuff that is supposed to be "really good stuff".
Would it be poor manners to point out that this is the exact converse of your "you haven't done enough C++ yet" argument...? ;-)

It is my opinion that Java itself lends itself to this, because of its pile-everything-into-the-same-file approach to writing.
Wrong. One class (and associated inner classes) per module. No headers needed. Why? Because the interface information is inscribed in the compiled object. Separating interface out in headers only creates a maintenance hassle, because you have to change TWO files when the interface changes. Not to mention all the necessary #include dependencies. If you want a readable interface document, read the Javadocs. That's what they are there for. Using .h files as interface documentation is a bad idea too.

But I doubt you'd disagree that someone who can make a complete mess of a C++ source file can (and generally will) make an equal mess of an Objective C source file, or a Java source file as well, for that matter.
An equal mess? Not at all. Poor Java code still compiles cross platform and cross compiler. And I will continue to disagree with your assertion that Java doesn't help to protect me against other people's stupidity. Case in point: the virtual keyword in conjunction with using 3rd party libraries.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Geronimo!
Jumping in here. Because C++ is most certainly the most misused language ever created.

When not to use C++:

1) You need to do object oriented programming.
2) You need to have a UI.
3) You need to write business logic.
4) You have a single programmer that doesn't genuflect when you say "Scott Meyer".
5) You don't need high efficiency.
6) Your project will grow to more than 5 people.

When to use it:

1) You need abstract data types.
2) You completely understand your compiler.
3) You already have a copy of Purify.
4) You have fairly high (but not maximal - they were maximal you'd use C or asm) efficiency requirements.

C++ is the worst OO language ever written. It has no interesting meta information in the runtime - the compiler throws it all away. This makes binding to GUI libraries a huge PITA. It makes binding to database records a huge PITA. It forces ORB vendors to do horrific code generation to put the missing meta info back into the runtime.

C++ lacks clarity on whether something is an abstract data type or an object. (Hint - ADTs don't get allocated in the heap, they live on the stack - you override operators for them and you pass them by reference - basically you're extending the language when you write adts - this can be useful - they never have virtual functions and you reuse logic via code generation - you know templates).

Class support is weak. The object runtime model (vtables) is shit. The existence of the virtual keyword is unfortunate - because when you're doing classes you really want everything to be virtual. C++ is the only language with this stupid idea and its a huge source of bugs - because the compiler doesn't always catch it and its very possible to have a system that produces incorrect results because you tried to override a non-virtual method. Inconsistent builds can crop up or you can get a library where the original developer didn't think to declare a method virtual but you want to override it - but you can't. There's no interface for extending or fiddling or even accessing the vtable. There's no way to lookup a method by name. There are 5 kinds of cast operators - 4 of them safe and intended to give you a little bit of help with compensating for the lack of useful meta info.

If you have strict memory requirements - C++ is not for you. Given the existence of templates and all of the compiler's gratuitous writing of methods for you (you know the big 4), its pretty much impossible to tell how big your program is likely to be (and its usually a lot bigger than most people think). In fact, a tiny change to a program can make a huge difference in its efficiency. This is because of the really stupid policy of automatic type conversions.

I personally got tired of the testosterone laden environment on C++ projects. Really smart programmers are attracted to C++ but its not because its a good language, but because its both a huge intellectual challenge for them and makes them elite if they can figure it out.

I could go on for hours - but these are a good summary of it. If most people write shitty programs in a languge - the language must have some problems.



I think that it's extraordinarily important that we in computer science keep fun in computing. When it started out, it was an awful lot of fun. Of course, the paying customer got shafted every now and then, and after a while we began to take their complaints seriously. We began to feel as if we really were responsible for the successful, error-free perfect use of these machines. I don't think we are. I think we're responsible for stretching them, setting them off in new directions, and keeping fun in the house. I hope the field of computer science never loses its sense of fun. Above all, I hope we don't become missionaries. Don't feel as if you're Bible salesmen. The world has too many of those already. What you know about computing other people will learn. Don't feel as if the key to successful computing is only in your hands. What's in your hands, I think and hope, is intelligence: the ability to see the machine as more than when you were first led up to it, that you can make it more.

--Alan Perlis
New Attacking Java doesn't make C++ better
IMHO, they both suck. Just at different things.

I must ask: How do you interate through a list of sequentially organized objects?


Java has a base class Object that all other classes automatically extend. All Collections are written in terms of Object. You have to downcast when pulling something from a collection. Unlike C++, you can just ask what the type of the object is and do something useful from there. But this sucks too. It comes from static typing. I don't much care for static typing. But this is the [link|http://ventedspleen.weblogger.com/discuss/msgReader$7?mode=day|difference] between function calling and message passing languages. There are more analyses of whats good and not good about C++/Java/Smalltalk/ObjectiveC on my blog (which I admittedly don't write for too often).




I think that it's extraordinarily important that we in computer science keep fun in computing. When it started out, it was an awful lot of fun. Of course, the paying customer got shafted every now and then, and after a while we began to take their complaints seriously. We began to feel as if we really were responsible for the successful, error-free perfect use of these machines. I don't think we are. I think we're responsible for stretching them, setting them off in new directions, and keeping fun in the house. I hope the field of computer science never loses its sense of fun. Above all, I hope we don't become missionaries. Don't feel as if you're Bible salesmen. The world has too many of those already. What you know about computing other people will learn. Don't feel as if the key to successful computing is only in your hands. What's in your hands, I think and hope, is intelligence: the ability to see the machine as more than when you were first led up to it, that you can make it more.

--Alan Perlis
New does the content of this thread indicate Bryce is right? :-)
will work for cash and other incentives [link|http://home.tampabay.rr.com/boxley/resume/Resume.html|skill set]

questions, help? [link|mailto:pappas@catholic.org|email pappas at catholic.org]
New Inasmuch as:
Yes, Virginia, there are shitty OO languages out there... ;-)
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New C++ implements OO programming
the way Microsoft implements security.



I think that it's extraordinarily important that we in computer science keep fun in computing. When it started out, it was an awful lot of fun. Of course, the paying customer got shafted every now and then, and after a while we began to take their complaints seriously. We began to feel as if we really were responsible for the successful, error-free perfect use of these machines. I don't think we are. I think we're responsible for stretching them, setting them off in new directions, and keeping fun in the house. I hope the field of computer science never loses its sense of fun. Above all, I hope we don't become missionaries. Don't feel as if you're Bible salesmen. The world has too many of those already. What you know about computing other people will learn. Don't feel as if the key to successful computing is only in your hands. What's in your hands, I think and hope, is intelligence: the ability to see the machine as more than when you were first led up to it, that you can make it more.

--Alan Perlis
New Not at all.
Smalltalk does OO right, as many people here can attest.

Hell, people successfully use OO in PHP, which is as OO as C++ (but done better). I even OO'ed something in PHP because it wasn't working any other way! I don't like objects in C++, though; too much overhead to write.

Wade.

Is it enough to love
Is it enough to breathe
Somebody rip my heart out
And leave me here to bleed
 
Is it enough to die
Somebody save my life
I'd rather be Anything but Ordinary
Please

-- "Anything but Ordinary" by Avril Lavigne.

     Re: There is NOTHING wrong with pointers! - (admin) - (46)
         Re: There is NOTHING wrong with pointers! - (dshellman) - (5)
             Cross-platform can be nasty. - (admin)
             Er,...really? - (jb4) - (3)
                 Java pointer problems - (ChrisR) - (2)
                     OT: threading - (admin)
                     Just a nit - (dshellman)
         Re: There is NOTHING wrong with pointers! - (deSitter) - (1)
             Re: There is NOTHING wrong with pointers! - (admin)
         I guess I don't see the problems with the compiler - (jb4) - (33)
             Hmmmm - seems this thread got derailed due to ... - (dmarker) - (27)
                 Java isn't a systems language at all, IMO. - (admin) - (26)
                     I sure wouldn't use Java for Systems work - (dmarker) - (25)
                         Which brings up the point: what IS systems work - (admin) - (24)
                             The other aspect is... - (ChrisR) - (18)
                                 Stroustrup has a great quote about that: - (admin)
                                 Which is why C/C++ can be easily integrated with anything - (Arkadiy) - (16)
                                     *C* is the lingua franca. - (admin) - (15)
                                         ObjectiveC++ - (tuberculosis)
                                         Welcom to my nightmare! - (jb4) - (13)
                                             ABI: Application Binary Interface - (admin) - (12)
                                                 I used to think Direct To SOM compilers would fix this - (tuberculosis) - (1)
                                                     Some progress has been made. - (admin)
                                                 Snide remark and a question - (jb4) - (5)
                                                     Snide response. - (admin)
                                                     Libraries - remember those? - (tuberculosis) - (2)
                                                         Exactly. - (admin)
                                                         Reality check: why libraries matter: - (admin)
                                                     Libraries - remember those? - (tuberculosis)
                                                 a day late and a dollar short...but extern "C" - (Simon_Jester) - (3)
                                                     For a 3rd party module? No. - (admin) - (2)
                                                         If you export C++ mangled functions, you're screwed. - (Arkadiy) - (1)
                                                             Or, rather: Export C++ mangled functions in a lib you sell.. - (CRConrad)
                             Simple - (deSitter)
                             No - (Arkadiy) - (2)
                                 But, in the hands of a good programmer, it's a sharp tool. - (admin) - (1)
                                     Like Cathie Ryan said... - (Arkadiy)
                             Friend of a Friend - (tuberculosis)
             Re: I guess I don't see the problems with the compiler - (admin) - (2)
                 OK, here's where we agree to disagree, and agree to agree... - (jb4) - (1)
                     Re: OK, here's where we agree to disagree, and agree to agre - (admin)
             Geronimo! - (tuberculosis)
             Attacking Java doesn't make C++ better - (tuberculosis)
         does the content of this thread indicate Bryce is right? :-) -NT - (boxley) - (3)
             Inasmuch as: - (admin)
             C++ implements OO programming - (tuberculosis)
             Not at all. - (static)

Just playing with your LRPD addiction...
331 ms