Solved

Delphi vs. Visual C++

Posted on 1998-12-23
12
407 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now