🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #6737

Re: custom VCL exceptions, how?

#6737
From: Jonathan Benedicto
Date: Mon, 18 Apr 2005 16:17
47 lines
2274 bytes
"Francisco M. Marzoa" <fmmarzoa@softronica.org> wrote in message 
news:4263da98@newsgroups.borland.com...
> It compiles fine, thanks a million. BTW, now it says that a return 
> statement that I've just after throw the extension is an 
> "Unreachable code". Do you know why?

You can remove that return. I hope I can explain this.

VCL apps are built like this : (much-simplified)

WinMain
{
    try
    {
        YourApplication
        {
            // if your code throws an exception, that does not have
            // a try / catch block around it somewhere, then the
            // exception gets caught back here in WinMain.
        }
    }
    catch()
    {
        HandleException
    }
}

So, you don't need that return because your methods will just stop 
executing, and the app will "hop" to the "nearest" try / catch block. 
By nearest, I mean like this:

try    // Then this one.
{
    try    // This is the nearest
    {
        throw Exception("...");
    }
}

try    // Not this one.
{
    OtherCode();
}

I've tried to explain it clearly, but I hope that you can follow it.

Jonathan 
Technical Details
Message-ID: <4263dd94$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news3.google.com!news.glorb.com!transit.nntp.hccnet.nl!transit1.nntp.hccnet.nl!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <4263d57c@newsgroups.borland.com> <4263d6dc@newsgroups.borland.com> <4263da98@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,b4c3995c44850950
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Jonathan Benedicto" <incorrect@no.server>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4263d57c@newsgroups.borland.com> <4263d6dc@newsgroups.borland.com> <4263da98@newsgroups.borland.com>
Subject: Re: custom VCL exceptions, how?
Date: Mon, 18 Apr 2005 12:17:23 -0400
Lines: 49
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 69.158.118.184
Message-ID: <4263dd94$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1113841044 69.158.118.184 (18 Apr 2005 09:17:24 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news3.google.com!news.glorb.com!transit.nntp.hccnet.nl!transit1.nntp.hccnet.nl!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail