flat assembler
Message board for the users of flat assembler.

Index > Heap > Do you need C++?

Goto page Previous  1, 2, 3  Next
Author
Thread Post new topic Reply to topic
itsnobody



Joined: 01 Feb 2008
Posts: 93
Location: Silver Spring, MD
itsnobody
f0dder wrote:
itsnobody wrote:
Well in reality they are DWORDs regardless of what you label them
On 64bit systems they're QWORDs, not DWORDs Smile

Right, that's the difference between 32-bit and 64-bit

That's basically it and some minor differences, pretty easy to port from Win32 ASM to Win64 ASM

Probably easier than porting it to 64-bit with C/C++, you probably have to change a million things in the compiler before it would work Very Happy

f0dder wrote:

And, really, what gives most information about usage?
MyFileFunction(char *filename, AsyncRecord *par); or MyFileFunction PROTO :DWORD,:DWORD? Even if you add names to the proto, you're allowed to pass anything that fits in a dword without type checking. Bad.

That's not FASM

FASM Win32 would look like "proc MyFunction,filename,AsyncRecord"

As for passing something without type checking, it's not usually a problem

f0dder wrote:

itsnobody wrote:
64-bit Windows looks very similar to 32-bit Windows....64-bit seems to be better thought out in design, but benchmarks don't show much of any speed difference
General speed doesn't change much, but why would it? Most apps sit pretty idle most of the time, and ontop of that most apps are still32bit. If you want speed increase, you have to recompile for 64bit, and only CPU-intensive code has advantage from that. It's not like a 64bit idle loop is more efficient than a 32bit idle loop Wink

But benchmarks show that 64-bit compiled code really doesn't have much advantages except in a few areas

I'm sure though once more people program in 64-bit and use the new features of it it'll be faster

f0dder wrote:

itsnobody wrote:
If you want real multi-platform support then stick to Java, with JIT it's just as fast as C++ and the same bytecode runs on almost any platform
Umm... no, JAVA JITers don't generate nowhere code nowhere near the quality of C++ compilers, sorry. For some simple cases they can do okay, but for real-world code, there's a very big difference.

And run on any platform, ho humm. On x86-64, I'm pretty sure the JITer still targets 32bit.

Yeah they do, make a benchmark and see

The only case where Java is slower is with graphics, other than that Java JIT is as fast or faster than C/C++

Plus Java is more multi-platform, the same compiled bytecode will run on Windows, Linux, Mac, Cellphones, PS3, Xbox, etc...
Post 17 Feb 2008, 21:00
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
itsnobody wrote:
Probably easier than porting it to 64-bit with C/C++, you probably have to change a million things in the compiler before it would work Very Happy
For decently written code, all you do is use the x86-64 compiler instead of the 32bit compiler - presto. And no, you don't need a zillion #ifdef/#else/#endif blocks.

Compare that to assembly - completely different calling convention, all pointer-related and many integer-related pieces have to be changed to QWORD instead of DWORD (and if you use EQUs for that, you're already moving away from the utterly stupid "everything is a DWORD" paradigm).

Some code will be able to work as-is on 64-bit, but you end up with size prefixed as well as not taking advantage of the 64bit features: wider & more general-purpose registers.

itsnobody wrote:
As for passing something without type checking, it's not usually a problem
Oh really? Typechecking is <3... will catch silly programmer mistakes at compile-time, instead of crashing (or worse) at runtime.

itsnobody wrote:
But benchmarks show that 64-bit compiled code really doesn't have much advantages except in a few areas
As I already said, only CPU-intensive stuff - and not everything.

itsnobody wrote:
I'm sure though once more people program in 64-bit and use the new features of it it'll be faster
Well, word, excel, explorer aren't really going to run faster from 64-bit code. But graphics/sound processing, code dealing with bignums etc. can benefit, and sometimes a lot.

itsnobody wrote:
The only case where Java is slower is with graphics, other than that Java JIT is as fast or faster than C/C++
Heh Smile

Speaking of SUNs environment, which is what most people run: JAVA programs end up using more memory, they load slower, and perform slower, than native C++ code. Microsoft's JVM was a lot better, but they were forced to discontinue that because of the lawsuit.

A simple "benchmark" that does nothing but multiplying or dividing numbers in a loop doesn't really say much about real-world performance.

Oh, and as for multi-platform, again please do check out the real world. Even though cellphones generally implement J2ME the games generally aren't cross compatible, and you run into other platform-dependent issues as well.
Post 17 Feb 2008, 21:58
View user's profile Send private message Visit poster's website Reply with quote
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY
Here in Brazil, Delphi used to be used a lot in commercial development. Then Java was a lot used too. And then came .NET and C# started to be used a lot.

But C++ remains the most widely used language for hardcore stuff. (not simple database programs like Java/Delphi/C# do).
And C for lower level stuff. And ASM for even lower level stuff.

So, I think C/C++/ASM is good combo for working in hardcore development.

Perl is also a lot used for web stuff.

One language I like a lot is Tcl. It's very easy to do metaprogramming due to it's very flexible scripting nature. It's like a mix of C and Lisp. Weird stuff but very simple and powerful.

I see Object Pascal as a good alternative for C++, although not so widely used.
I guess I'll study C++ more deeply and then I'll come in a conclusion. And at least C++ is not a "trendy" language that come and go, like many others. So, no time wasted.

And BTW, Lua was created here in Brazil. It's used as scripting for games, but I really never looked at it.

And D seems to have lots of potencial. When it becomes more widely used it may beat C++.
Post 17 Feb 2008, 22:31
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
Btw there's no reason why C++ can't be used for lowlevel stuff instead of C, since C++ is pretty much a superset of C++ - that you shouldn't use C++ for kernel development etc. is just old superstition.

Whether you should use all C++'s features for low-level development is another thing, though - I wouldn't use C++ exception handling and RTTI at kernel level, and be careful about a lot of other things. But better type safety, templates, and the fact that object destructors are called when they go out of scope can be very handy for kernel-mode development, and reduce code complexity as well as reduce bugs.

OzzY wrote:
And at least C++ is not a "trendy" language that come and go, like many others. So, no time wasted.
Indeed - it's been with us for ages, and will most likely stay with us for ages to come. It's not the best tool for everything, but it's allround a pretty decent language, and extremely flexible.

OzzY wrote:
And BTW, Lua was created here in Brazil. It's used as scripting for games, but I really never looked at it.
It's a nice little language, and it's used for more than just scripting games. A very short & incomplete list can be seen here. It's small enough overhead that some people use it only for configuration files Razz

OzzY wrote:
And D seems to have lots of potencial. When it becomes more widely used it may beat C++.
It has some nice features, but it'll never beat C++, simply because it isn't C++ Smile - in the same sense that I doubt we'll see anything replacing x86 for the desktop anytime soon. 100% market penetration & saturation, baby.
Post 18 Feb 2008, 00:15
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
no, i don't need C or C++, i need a good and easy lib for asm.
with evolutivity possible.
Post 18 Feb 2008, 00:22
View user's profile Send private message Visit poster's website Reply with quote
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY
I wish there was a Pelles C++. Very Happy
I like Pelles C IDE as been light and so well done.
I don't like Visual Studio too much. I think it's badly organized.
Post 18 Feb 2008, 00:40
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
Visual Studio has some very powerful tools for more complex projects, though... and code generation beats Pelle's C (and other LCC-based compilers).
Post 18 Feb 2008, 00:54
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
> Do you need C++?

NO.

> What's your opinion on C, C++, C# and other C-like languages?

C : OK
C++ : crap
C## : crap
Post 18 Feb 2008, 05:46
View user's profile Send private message Reply with quote
m



Joined: 28 Dec 2006
Posts: 304
Location: in
m
C++ prefers program efficiency over programmer efficiency!
Java prefers programmer efficiency over program efficiency!

As simple as that Smile

_________________
Attitude!
Post 18 Feb 2008, 11:51
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
DOS386 wrote:
> Do you need C++?

NO.

> What's your opinion on C, C++, C# and other C-like languages?

C : OK
C++ : crap
C## : crap


Do you have any experience with C++, or are you just plain ignorant talking out of your ass? Smile

_________________
Image - carpe noctem
Post 18 Feb 2008, 12:26
View user's profile Send private message Visit poster's website Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1607
Location: Ukraine
shoorick
valuable opinion must base on deep experience of usage, but not on negative emotion of the first failed try.
sure, C++ is must be known, even if you do not use it, as it is standart language, a kind of "ABC".
Post 18 Feb 2008, 13:53
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
Quote:
C++ prefers program efficiency over programmer efficiency!
Java prefers programmer efficiency over program efficiency!

As simple as that


Shocked
c++ and java are hll
nothing more, nothing less.
with them, many programmers earn money, but their programms are totally bugged.

i alway cross fatal errors with java.
and for c++, i don't know, but i'm sure tthis hll is one more stone to the edifice, that is builded on moving sands.all the computer world is nothing
all the oses are endless.
when i use my PC, it's not to be dependant on any os, but to launch applications, and make work with.
the os is just the product to sell.
vista is the last soup of m$, ubuntu need at least a 686 to work, the oses eat more and more ressource.
one day, the os will be the application:
mr smith -yeah, i have a good os, with 3D
mr dupont -ho gosh, my os is better than your
mr smith -no way, i have the new m$ astalavistababy
mr dupont -and me, i believe only in linux, so, m$ is bad
mr me -hehe, you seem to be busy, but you only play with a game, the os builded to give you occupation...
mr smith and mr dupont -with our computers, we code in c++ and java.
and we earn money, we earn a lot of money to do nothing...
mr me - erf!
Post 18 Feb 2008, 14:12
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17474
Location: In your JS exploiting you and your system
revolution
edfed wrote:
mr smith -no way, i have the new m$ astalavistababy
LOL, I can just imagine Bill Gates saying "I'll be back."
Post 18 Feb 2008, 14:23
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
Btw there's no reason why C++ can't be used for lowlevel stuff instead of C, since C++ is pretty much a superset of C++ - that you shouldn't use C++ for kernel development etc. is just old superstition.

you have to type ugly

Code:
#ifdef __CPLUSPLUS
extern "C" {
#endif    


to all headers, if you want to mix languages (eg. use Assembly) Laughing
Post 18 Feb 2008, 21:39
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2341
Location: Usono (aka, USA)
rugxulo
Just because the jobs for C++ are available doesn't mean you'll be skilled enough (or willing) to work/fix for 10+ hours a day on some boring crap that is outdated because the latest G++ broke it and/or the new upcoming standard says such and such is deprecated. Unless you're maintaining someone else's code, it doesn't matter what language you write your stuff in. (And Python is the "real" ABC, heh.)

C++ isn't crap. But it is slightly bloated. It's not necessarily best for 100%, but 95% (with a little external assembly) can help a lot.

P.S. Win64 is supposedly 10% faster, and you can (only) run 32-bit apps as-is, but don't bother unless you don't care about skimpy drivers (hard enough to get for 32-bit Vista!) and larger memory footprint. But at least there you can use > 3 GB of RAM.

Computers are changing too fast for anybody to really invest their time wisely. Everything becomes outdated, some faster than others. Just do what's easiest, fun, and isn't completely crazy (COBOL OS? Heh.). Wink
Post 19 Feb 2008, 03:49
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
vid wrote:

you have to type ugly

Code:
#ifdef __CPLUSPLUS
extern "C" {
#endif    


to all headers, if you want to mix languages (eg. use Assembly) Laughing


__cplusplus, you mean - not upper-case Wink. And I don't see how that's ugly, it's 6 lines total you need to add... and it's only necessary if you have a C-compatible interface that you want non-C++ code (C, asm, ...) to be able to call, anyway.

rugxulo wrote:
P.S. Win64 is supposedly 10% faster, and you can (only) run 32-bit apps as-is, but don't bother unless you don't care about skimpy drivers (hard enough to get for 32-bit Vista!) and larger memory footprint. But at least there you can use > 3 GB of RAM.

Dunno if XP64 itself is faster than XP32, it's a bit hard to measure on today's processors... when something feels slow, it's usually disk related, and moving to a 64bit OS obviously doesn't make your harddisk any faster Wink

But being able to use more than 4GB ram is nice, even if 32-bit apps can still only see 2 gigs (or 3 gigs, if the right bit in the PE header is set). Notice that while the 2:2/3:1 split exists for 32bit apps, there really isn't any reason why you can't stuff in 8 gigs in a 32bit windows and have have each app use different 2gig parts - PAE was introduced quite a while ago.

Btw, pre-sp2 XP could use 4gb of physical ram - with SP2, it's 4gb of address space. And yes, there's (quite) a difference between the two. Microsoft cites "compatibility reaons"...

_________________
Image - carpe noctem
Post 19 Feb 2008, 09:22
View user's profile Send private message Visit poster's website Reply with quote
drhowarddrfine



Joined: 10 Jul 2007
Posts: 535
drhowarddrfine
Steve Yegge has some comments about the popular languages. Though you might find the whole article interesting, he talks about Java and C/C++. Scroll down to "Creeping Bureacracy".Portrait of a Noob
Post 19 Feb 2008, 17:02
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
drhowarddrfine wrote:
Steve Yegge has some comments about the popular languages. Though you might find the whole article interesting, he talks about Java and C/C++. Scroll down to "Creeping Bureacracy".Portrait of a Noob

Pretty nice and humbling piece of text Smile

EDIT: I don't agree 100% with him on the static type bashing, though. Dynamically typed languages can be good for some tasks, especially prototyping, but you can also get some really nasty runtime bugs. Like, letters adressed to "John Smith, Penny Lane 11:00PM" instead of "Penny Lane 23"... and that's a very mild example, consider what that kind of bug could do in the financial world? Wink

_________________
Image - carpe noctem
Post 19 Feb 2008, 23:48
View user's profile Send private message Visit poster's website Reply with quote
Japheth



Joined: 26 Oct 2004
Posts: 151
Japheth
rugxulo wrote:
Just do what's easiest, fun, and isn't completely crazy (COBOL OS? Heh.). Wink


I know Cobol very good (the HX DOS extender was in fact born in a Cobol project - to avoid the license fees for MicroFocus Cobol and instead using Microsoft Cobol in protected mode). Cobol is good, of course outdated nowadays because it's not OO, but it was preferred to C/C++ in many areas of programming until Java arrived. It's advantages were:

- virtually "self-documenting" (compared to the "write-only" C/C++ code)
- many and good compilers available
- good possibilities to define data structures (ways better than C)
- built-in support for BCD arithmethic
- easy interfacing with other languages (assembly)
- built-in index-sequential file access

In two words: Cobol ROCKS!
Post 21 Feb 2008, 17:04
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
__cplusplus, you mean - not upper-case . And I don't see how that's ugly, it's 6 lines total you need to add... and it's only necessary if you have a C-compatible interface that you want non-C++ code (C, asm, ...) to be able to call, anyway

also there is need for some special declaration of funcs which need to be called from assembly (which we of course need so often). And that is AFAIK non-portable-over-compilers, so you need another "header for every compiler", etc...

Razz Wink
Post 21 Feb 2008, 20:48
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.