Hello,

In addition to the reasons people have exposed, there is one more
thing against exceptions: they require RTTI, which makes executables
and libraries larger.

Given that Wt targets the embedded market, where memory is limited, I
think it'd make sense that Wt could be compiled without RTTI. That
requires code without exceptions.

That's actually one of the reasons Qt do not use exceptions at all
(the other being at the time compilers were quite crappy in regards to
RTTI :-) )

On Sun, Dec 12, 2010 at 12:43 AM, Gaetano Mendola <[email protected]> wrote:
> On Sat, Dec 11, 2010 at 11:34 PM, OvermindDL1 <[email protected]> wrote:
>> On Fri, Dec 10, 2010 at 6:31 AM, Koen Deforche <[email protected]> wrote:
>>> Hey Sohail,
>>>
>>> 2010/12/8 Sohail Somani <[email protected]>:
>>>> On 10-12-08 11:19 AM, Koen Deforche wrote:
>>>>> I've fixed WRegExp so that passing it an invalid regular expession
>>>>> makes isValid() return false but does not throw an exception.
>>>>>
>>>>
>>>> Is that how Wt works in general? C++ best practice would state that
>>>> constructed objects should not be invalid and that constructors should
>>>> throw.
>>>
>>> In Wt::Dbo we throw exceptions, in Wt itself there is not much that
>>> can go wrong (in this sense). If it is a misuse of the API we throw an
>>> exception. If it is a problem with input (like this case), we mimic
>>> the behaviour of Qt, which is usually to indicate the error using an
>>> isValid() method. This is probably somewhat misguided and I would
>>> agree it is more correct to throw an exception instead. Fortunately,
>>> there is not alot of situations in Wt where an object construction can
>>> leave the object in an invalid state.
>>>
>>> Entirely personally, I find that a try {} catch block often breaks the
>>> legibility of the code, and for plain methods I prefer a return type
>>> check over an exception.
>>
>> Personally I would prefer if the constructor throws, reasons are that
>> I want my app to die horribly if something *I* programmed, like a
>> regex, is wrong.  However, if I feed it a regex from an external
>> source (from the web page for example), then I will try/catch around
>> it because I do not trust user input in any way, shape, or form.
>
> STD has examples of same "pattern" check after construction, see
> ifstream/ofstream
> for example, after you have instances of those classes you have to
> test it before starting
> using it. Consider also that dealing with exception is not easy, it's
> not enough a block
> try/catch and that's all.
>
> Regards
> Gaetano Mendola
>
> --
> cpp-today.blogspot.com
>
> ------------------------------------------------------------------------------
> Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL,
> new data types, scalar functions, improved concurrency, built-in packages,
> OCI, SQL*Plus, data movement tools, best practices and more.
> http://p.sf.net/sfu/oracle-sfdev2dev
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>



-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)

------------------------------------------------------------------------------
Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL,
new data types, scalar functions, improved concurrency, built-in packages, 
OCI, SQL*Plus, data movement tools, best practices and more.
http://p.sf.net/sfu/oracle-sfdev2dev 
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to