IDMclean Posted October 8, 2007 Report Posted October 8, 2007 That depends on what you mean by "effectively." C++ has the advantage of still being kinda-sorta low-level like its parent C is, so to a certain extent, your C++ code can influence how the machine code gets generated, and you have the ability to directly manipulate the memory layout of objects (via pointers!). As to whether that's a *benefit* or not, well, that depends on who you are and what you want! The real significant difference at a high-level though between C++ and Java is that Java intentionally left out multiple-inheritance, a weakness that can be gotten around, but makes C++ a lot easier for really complex systems modeling. Java also fixed the linking problems that are inherent in C++ implementations (mostly *just* an implementation/backward compatibility issue, but to a great extent also because pointers went away!), so if modular development is one of your primary goals, Java is going to be *much* easier to deal with. I've never written a lot of Java, mainly because I've written C++ for so long, but for practical reasons have jumped over to C# which is almost identical to Java anyway. [rant]Well, it's mainly how C++ is setup that makes it difficult for me to read. Like for instance the use of headers, different kinds of objects (java has class; C++ has struct and class), pointers, and references. What I mean by effectively comes from my delving into video game design. Java is impractical for game design. It's overhead and resource usage is too high; furthermore, it's inability to manage your resources by way of program makes it nigh-impossible to successfully swap resources without increasing overhead geometrically or exponentially. Simply put, in Java I lack the ability to call for an object to be destroyed/released from memory at will; Garbage collection is hardly effective and unreliable. Also of importance, is that Java still lacks hooks for graphical/audio languages such as OpenGL, Direct X, and C-Audio. Then we can start to talk about building GUIs for games trying to use Swing or AWT. Java is great for applications and web work; however, it's flaws become glaring when one attempts to use it for highly dynamic, massive, simulation systems like games.[/rant] Quote
Buffy Posted October 8, 2007 Report Posted October 8, 2007 [rant]...Java is great for applications and web work; however, it's flaws become glaring when one attempts to use it for highly dynamic, massive, simulation systems like games.[/rant]And game development is still very low-level. If that's what you're building, then C++ is the right tool. It amazes me how languages become so contentious that they make the wars between religions look like polite debating contests. *Every* language has *some* benefits, and they're appropriate in different contexts. In my book if you're not fluent in at least 6 languages and willing to use each whenever its appropriate, you're not a "real programmer." When all you have is Java, everything is a cappuccino, :hihi:Buffy Quote
alexander Posted October 9, 2007 Report Posted October 9, 2007 Buffy :eek_big: ASP, Assembly (8085 and a Mips-based assembly for a robot controller), Awk, Bash, Batch, BC, C, C++, Dark Basic, Delphi, Java, JavaScript, Microsoft Basic, Pascal, Perl, PHP, Python, Ruby, Visual Basic, VB Script, Quick Basic and a few markup and type-setting languages:Latex, HTML, XML, XHTML, CSS I 100% stand behind Buffy's words :( Quote
LaurieAG Posted October 12, 2007 Report Posted October 12, 2007 Hi Buffy, And game development is still very low-level. If that's what you're building, then C++ is the right tool. It amazes me how languages become so contentious that they make the wars between religions look like polite debating contests. *Every* language has *some* benefits, and they're appropriate in different contexts. In my book if you're not fluent in at least 6 languages and willing to use each whenever its appropriate, you're not a "real programmer." When all you have is Java, everything is a cappuccino, :clock:Buffy I found this on the Java site C/C++ compilation produces machine specific binary files whereas java compilation produces binary format that is specific to the Java Virtual Machine. and on JPython Implementing Python in Java has a number of limitations when compared to the current implementation of Python in C. These include about 1.7X slower performance, portability limited by Java VM availability It should also be noted that MS VS C++ will be slower than native C++ if you are developing a program with your own GUI (like most of the major games developers), because native C/C++ are compiled programs while MS Visual Studio C++ is an interpreted program ( i.e. a runtime program that can include binary executables). Quote
Qfwfq Posted October 19, 2007 Report Posted October 19, 2007 Thanx but the only thing in there that none of us had ever known is:MS Visual Studio C++ is an interpreted program ( i.e. a runtime program that can include binary executables).I've hacked with it for a long time and managed to do plenty of geeky things in it, fiddled with project settings trying weird options, I even found out how to compile a VB6 program and then trace it in MS Visual Studio C++ to see the VB source and machine code mixed together, but I never figured out how to run C++ source interpreted instead of compiled. :lightning Quote
Qfwfq Posted October 19, 2007 Report Posted October 19, 2007 It amazes me how languages become so contentious that they make the wars between religions look like polite debating contests.But Java is a religion! If you don't bow down to Ra, you'll never like it... Quote
LaurieAG Posted October 24, 2007 Report Posted October 24, 2007 Thanx but the only thing in there that none of us had ever known is:I've hacked with it for a long time and managed to do plenty of geeky things in it, fiddled with project settings trying weird options, I even found out how to compile a VB6 program and then trace it in MS Visual Studio C++ to see the VB source and machine code mixed together, but I never figured out how to run C++ source interpreted instead of compiled. :confused: Hi Q, What you say seems to confirm an interpreted runtime rather than a compiler. Do you think that MS VS C++ is reverse compiling the binary executables into source to view the trace or do you think that MS VS C++ is interpreting both the interpreted (did your compiled VB6 program have a runtime?, they don't need the runtime when traced in the MS VS development environment) VB6 program and the binary executables? I had a small program (800k complete install disk) that required one function from MS VS Foxpro (to convert an xbase file to MS Excel format). This one function required a 9MB runtime where the compiled Foxpro 2.6 version of the required function was 16k. The core element in MS Visual Studio products is the interface (and all of the extra runtime files), something that is not required if you are creating a game (that doesn't need next years processors to run acceptably). Did you work out how to circumvent the MS VS 'wobble' bug in 1999/2000? Jay-qu 1 Quote
Qfwfq Posted October 26, 2007 Report Posted October 26, 2007 Do you think that MS VS C++ is reverse compiling the binary executables into source to view the trace or do you think that MS VS C++ is interpreting both the interpreted (did your compiled VB6 program have a runtime?, they don't need the runtime when traced in the MS VS development environment) VB6 program and the binary executables?No, I'd say you're simply off track. You wouldn't perhaps be thinking of p-code would you? Quote
Buffy Posted October 26, 2007 Report Posted October 26, 2007 Do you think that MS VS C++ is reverse compiling the binary executables into source to view the trace or do you think that MS VS C++ is interpreting both the interpreted (did your compiled VB6 program have a runtime?, they don't need the runtime when traced in the MS VS development environment) VB6 program and the binary executables?If you haven't taken an advance compiler design class you may not be familiar with the methods for embedding source code line numbers and variable names/structure offsets in generated code, which is the way that most compilers that support full interactive debugging work: its not that they're interpreted, its that they're able to provide the debugger information about exactly where they are in the code, which is brought in and displayed separately. When you compile with the debugger information turned off, this all goes away, and is why that version is a smaller executable.I had a small program (800k complete install disk) that required one function from MS VS Foxpro (to convert an xbase file to MS Excel format). This one function required a 9MB runtime where the compiled Foxpro 2.6 version of the required function was 16k.Conditional linkage of functions within libraries is really hard: you need a full dependency tree *across* libraries: as a result, even the best linkers don't even bother. They leave it up to library developers to partition their modules into smaller chunks if they want smaller executables. If you go for modularized libraries, you can waste an awful lot of time on making sure you link all the required ones in (you may not be calling all the ones you need *directly*, but the stuff you are calling requires other stuff). This was common in the olden days, and all you have to do is look at /usr/lib© on a full *nix installation to see the problem. Microsoft has punted on the issue by simply having a couple of kitchen-sink libraries, and almost everything requires only the gigantic .Net library (although if you're using C++, you need its runtime too to get the CLR management stuff to work). Fortunately they do this with shared libraries, so you don't *have* to link them into your executables (in fact in the last couple of VisStudio releases, you really need to know what you're doing to find the option to do so!). But no, VisStudio C++ is not interpreted, in fact none of the VisStudio languages are (although FoxPro *is*, as well as old fashioned VBScript/ASP). Microsoft actually never spent much time with p-code implementations, as compared with Borland who used it almost exclusively (exception being their C++ oddly enough!). In general, C++ is used for "high-performance" apps, so if you build a C++ compiler that does not produce native code, no one will use it! Although alexander may not like it, the vast majority of PC apps are built with VisStudio C++. :P mov AX, 0xffffffff,Buffy Quote
LaurieAG Posted November 1, 2007 Report Posted November 1, 2007 But no, VisStudio C++ is not interpreted, in fact none of the VisStudio languages are (although FoxPro *is*, as well as old fashioned VBScript/ASP). Microsoft actually never spent much time with p-code implementations, as compared with Borland who used it almost exclusively (exception being their C++ oddly enough!). In general, C++ is used for "high-performance" apps, so if you build a C++ compiler that does not produce native code, no one will use it! Although alexander may not like it, the vast majority of PC apps are built with VisStudio C++. mov AX, 0xffffffff,Buffy Hi Buffy, Description of the predefined identifiers in Microsoft C and C++ _PCODE Defined for sections of code that are compiled as p-code. Macro defined when /Oq is enabled. The Microsoft Visual C++ 2005 SP1 Redistributable Package (x86) installs runtime components of Visual C++ Libraries required to run applications developed with Visual C++ on a computer that does not have Visual C++ 2005 installed. I'm not going to continue arguing about the semantic differences of MS's VFP, VB and C++ etc when a 'compiled binary executable' requires a 'runtime' if it is to be run on a machine independent of the development environment. The main point being that Java will run slower than a genuine compiled executable (and will probably run just as slow as anything 'compiled' that requires a runtime). Quote
Buffy Posted November 1, 2007 Report Posted November 1, 2007 No need to argue anymore, just want to clarify a few points for the audience with a--hopefully entertaining--historical perspective:Description of the predefined identifiers in Microsoft C and C++_PCODE Defined for sections of code that are compiled asp-code. Macro defined when /Oq is enabled.For a brief time, P-code (intermediate code) was an option only for 16-bit executables under Visual C++, but nobody ever used it! Its original purpose was to provide a distribution option in which the code was smaller, but it turned out that the advantage was quite small and floppy disks (whose limited capacity was the real motivation) were by that time going the way of the dinosaur. Its no longer supported except as a non-functional pragma (for compatibility with old source code) since there are no 16-bit applications anymore.I'm not going to continue arguing about the semantic differences of MS's VFP, VB and C++ etc when a 'compiled binary executable' requires a 'runtime' if it is to be run on a machine independent of the development environment. The main point being that Java will run slower than a genuine compiled executable (and will probably run just as slow as anything 'compiled' that requires a runtime).Unfortunately this is a point of confusion due to two segments of the industry using the same term to label two entirely separate notions: p-code and fully interpreted systems use the term "runtime" to refer to a program that interprets and executes source code or "partially compiled" code. At the same time, "redistributable libraries" (a mouthful) were relabeled as "runtimes" for fully compiled applications (you can even blame me: I was one of the "idiots in marketing" that was involved in this "industry convention"!). This was originally a contraction of the term "runtime library" which grew out of the notion first really made useful on Unix systems under the term "shared library" which really was trying to simply get across the notion that the library could be distributed and installed separately from the application and could be "dynamically linked at runtime" (see?). Microsoft has gone back to "redistributable package" to describe this. Bottom line though is that the code that's generated by the compiler is native machine code that is not interpreted in anyway, and the libraries are separate files that the operating system knows how to link to by virtue of appropriate requests in the program executable. A side note: why is there such a thing as "P-Code" at all? Because one of the first things you learn in compiler class is that 90% of the execution time used by a compiler is purely in reading the source and scanning it for its constituent elements (AKA "lexical analysis": what "lex" in "lex and yacc" does), so by getting rid of that step (in fact doing a lot of the parsing too), by translating the source code into "pre-lexed" intermediate code, you've bought a *huge* performance improvement over purely interpreted code, although not close to compiled code, especially for compute-intensive applications. msvcrt.dll,Buffy Quote
LaurieAG Posted November 1, 2007 Report Posted November 1, 2007 Hi Buffy, I found the following on Wiki. Fifth-generation programming language - Wikipedia, the free encyclopedia 5GL or fifth-generation programming language is programming that uses a visual or graphical development interface to create source language that is usually compiled with a 3GL or 4GL language compiler. Microsoft, Borland, IBM, and other companies make 5GL visual programming products for developing applications in Java, for example. A 5GL compiled with a 4GL compiler is an 'interpreted' executable and if it is compiled with a 3GL compiler it is a genuine 'compiled' executable. BTW the Wiki stuff on this is all mixed up and inconsistent, it's not surprising that things are confused. Quote
Buffy Posted November 2, 2007 Report Posted November 2, 2007 A 5GL compiled with a 4GL compiler is an 'interpreted' executable and if it is compiled with a 3GL compiler it is a genuine 'compiled' executable.I was one of the people responsible for this "5GL" monstrosity inflicted on the market back in the 90s. The company I worked for had multiple programing products, some of which were interpreted/p-code based (Visual Basic clones), while others generated C code and then compiled to object code. This actually had nothing to do with what the language was: in our case the Visual Basic clones were all interpreted whereas the 4GLs mostly (with an exception or two) actually compiled to C. Having been in the middle of it I can tell you quite definitively that "5GL" can mean any combination of the above. Blame us idiots in marketing, but everyone ended up making a lot of money off of it... 5GL actually was originally used by the Japanese to refer to development environments that incorporated Artificial Intelligence techniques, and later back-applied to the cited examples of Prolog and others which really predated the usage of the term "4GL"! But we Silicon Valley marketers stole it to refer to the "visual development with a 4GL" that you pulled out of the page. Among those of us who are really into languages though, the languages promoted as AI 5GLs really still mostly had all the earmarks of 4GLs (non-procedural, event-driven syntax), and at the time we used to joke that the language that *most* upheld the stated definition of a 5GL was in fact...wait for it... RPG!!!BTW the Wiki stuff on this is all mixed up and inconsistent, it's not surprising that things are confused.You said it. A lot of the Wiki programming history is *worthless*, so take it all with a block of salt. Non-procedurally yours,Buffy Quote
Qfwfq Posted November 6, 2007 Report Posted November 6, 2007 One thing is certain LaurieAG, none of what you say means that C++ is interpreted in Visual Studio, or even that 5GLs are. As usual, get your facts and the meaning of things straight before insisting so much. You are only disrupting a thread in which someone asked for help and clarifications. Quote
LaurieAG Posted November 8, 2007 Report Posted November 8, 2007 One thing is certain LaurieAG, none of what you say means that C++ is interpreted in Visual Studio, or even that 5GLs are. As usual, get your facts and the meaning of things straight before insisting so much. You are only disrupting a thread in which someone asked for help and clarifications. Hi Q, After designing and developing multi user database software for the past 20 years I would have to disagree with you. As far as I am aware this topic is called 'comparing and contrasting: C++ and Java'. My post re Wiki stating Java as being a 5GL (and the definition of a 5GL) is pertinent to this topic. And, unless you were unaware, Java is certainly an interpreted language that takes longer to process the same operation as a true compiled program. The discussion we are having is about wether MS VS C++ is a truely compiled executable or an interpreted program or a bit of both (which you'll find is closer to the truth). Do you have anything further to contribute to this discussion Q or do you have some other sort of agenda? Quote
LaurieAG Posted November 8, 2007 Report Posted November 8, 2007 You said it. A lot of the Wiki programming history is *worthless*, so take it all with a block of salt. Hi Buffy, You know it's funny really, because there are some purists around today who would argue that the only truely compiled programs around these days are DOS 3GL's (where all necessary elements are compiled into the one .exe from their respective libraries). And even Wiki stated that the higher level GL's can be compiled into a 3GL language (the original C was written in C). The difference between an interpreted program and a compiled program can be discovered by reading the unencrypted .exe file (produced by a compiler or MS VS product) in a word processor. If you see the screen forms and can read the code then you are definitely looking at an interpreted .exe not a compiled one (as in MS VB and MS VFP). And this difference is very important in games because it's the one that slows down the programs performance during operation. Quote
Buffy Posted November 8, 2007 Report Posted November 8, 2007 As far as I am aware this topic is called 'comparing and contrasting: C++ and Java'. My post re Wiki stating Java as being a 5GL (and the definition of a 5GL) is pertinent to this topic. And, unless you were unaware, Java is certainly an interpreted language that takes longer to process the same operation as a true compiled program. The discussion we are having is about wether MS VS C++ is a truely compiled executable or an interpreted program or a bit of both (which you'll find is closer to the truth).Was there something in my previous post that was unclear? I'd be happy to expound upon it some more, but "5GL" has no generally accepted definition--it is more than anything a "marketing term"--and saying VSC++ is a "bit of both" does not have any basis in fact: there is no difference in performance except an almost immeasurable delay at load time between monolithically generated executables and shared libraries, and using shared libraries has nothing to do with being interpreted. While Java is most popularly used in interpreted mode--mostly for portability--there are Java Compilers available that will compile to object code. /Zd, /Zi, /Zwhatever,Buffy Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.