Solved

Delphi vs. Visual C++

Posted on 1998-12-23
12
417 Views
Last Modified: 2010-04-04
I need comparison between Delphi and Visual C++, which is the best
0
Comment
Question by:Motaz
12 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1352710
look in previously asked question for information
0
 
LVL 7

Author Comment

by:Motaz
ID: 1352711
which question, ( Q number ) ?
0
 
LVL 7

Author Comment

by:Motaz
ID: 1352712
I need comparison here
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 20

Expert Comment

by:Madshi
ID: 1352713
Ok, let's do it again...

IMHO Delphi is much better for real win32 application designing/writing. Some facts:
- Delphi's strings handling is much better (better syntax and automatic allocation/deallocation)
- Delphi's COM implementation (version 3 or higher) is much better (automatic release and all that stuff)
- Dynamical arrays (version 4; automatic allocation/deallocation)
- Compiler is 1000000000000000000000 (ok, almost :-) times faster

There are probably other advantages that I do not use (databases and such stuff).

But if you want to write very small graphical applications (<30 KB) or even drivers, C++ is the better choice.
Also, if you need cross-platform code, C++ is probably better, because in C++ all the object stuff is ANSI standardized, while Delphi's object extensions to pascal are Inprise-specific.

Program speed/optimzation is equal between C++ and Delphi.

Perhaps a little source example (It's not the first time, I'm posting it in a discussion like this...):

Here's an original C++ Microsoft example about how to create a shell link:

HRESULT CreateLink(LPCSTR lpszPathObj, LPSTR lpszPathLink, LPSTR lpszDesc)
{
    HRESULT hres;
    IShellLink* psl;
    hres = CoCreateInstance(&CLSID_ShellLink, NULL,
        CLSCTX_INPROC_SERVER, &IID_IShellLink, &psl);
    if (SUCCEEDED(hres)) {
        IPersistFile* ppf;
        psl->lpVtbl->SetPath(psl, lpszPathObj);
        psl->lpVtbl->SetDescription(psl, lpszDesc);
        hres = psl->lpVtbl->QueryInterface(psl, &IID_IPersistFile, &ppf);
        if (SUCCEEDED(hres)) {
            WORD wsz[MAX_PATH];
            MultiByteToWideChar(CP_ACP, 0, lpszPathLink, -1,
                wsz, MAX_PATH);
            hres = ppf->lpVtbl->Save(ppf, wsz, TRUE);
            ppf->lpVtbl->Release(ppf);
        }
        psl->lpVtbl->Release(psl);
    }
    return hres;
}

Now my Delphi conversion:

function CreateLink(pathObj, pathLink, desc: string) : HRESULT;
var sl : IShellLink;
begin
  sl:=CreateComObject(CLSID_ShellLink) as IShellLink;
  sl.SetPath(PChar(pathObj));
  sl.SetDescription(PChar(desc));
  result:=(sl as IPersistFile).Save(PWideChar(wideString(pathLink)),true);
end;

Note these 3 facts:
(1) Delphi converts the string from ansi to multiByte for me.
(2) Delphi calls QueryInterface for me.
(3) Delphi releases the COM objects for me.

Regards, Madshi.
0
 
LVL 3

Expert Comment

by:Ronald Buster
ID: 1352714
You need a comparison why ?

Delphi has a better native compiler than visual C hence I even work sometimes with visual C/C++ and I find working with Delphi is far more easier than doing the same thing with
Visual C. However there are some benefits handling and creating com objects in visual c is some way better then in Delphi.

So it depends what you want to do, if I could give some advise I would prefer Delphi.

regards,

Cono
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1352715
So cono, why should handling of COM objects be better in C++ than in Delphi? Have you looked at my comment before answering the question?
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1352716
Hey, Madshi, why don't you start answering questions 'cuz your politeness will get you no where...

Merry Christmas!

-Viktor
--Ivanov
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1352717
You're right, Viktor...   :-(

There's a German song which sounds like "You have to be a pig on this world (if you want to be successful)".   :-)

I thought about answering this question. But it's only 20 points, so I can live without that...

Merry Christmas!

Regards, Madshi.
0
 
LVL 7

Author Comment

by:Motaz
ID: 1352718
Hi cono, I neet this comparison because here in Sudan university we study Visual C++, but I and some of my friends decide to write our projects by Delphi (  we study computer system and information technology in Sudan uni. Last year )

Thanks Madshi for your nice comment. I'll increase the points, but points is not all the matter, help people is the important.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1352719
Hi Motaz, you're right. Points are not so important, just a little bit motivation...

Hmm. I'm not sure. Are you satisfied with my comment? Do you want me to answer the question or are you waiting for more comments?

Regards, Madshi.
0
 
LVL 7

Author Comment

by:Motaz
ID: 1352720
I'm awaiting for more comments, but I'll accept your ansower, okay !

Motaz
members.wbs.net/homepages/a/z/z/azzoz.html
0
 
LVL 20

Accepted Solution

by:
Madshi earned 40 total points
ID: 1352721
Thank you, Motaz!

You should wait some days with accepting the answer. So perhaps you'll get some new comments...

Regards, Madshi.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question