wxCHECK and semicolon required

H H at h.com
Tue Apr 3 12:08:23 PDT 2007


In article <N2icxD.A.CWW.T1jEGB at brage.sunsite.dk>,
 vadim at wxwindows.org (Vadim Zeitlin) wrote:

> On Tue, 03 Apr 2007 13:33:48 +0200 H <H at h.com> wrote:
> 
> H> Is it really necessary that wxCHECK needs a semicolon?
> 
>  Yes, it's a statement-like macro.
> 
> H> With the current implementation the following statements or similar ones 
> H> are impossible:
> H> 
> H> if (!(String.IsEmpty()))
> H>   wxCHECK(String.ToULong(&Number),false);
> H> else
> H>   Number = 0;
> 
>  Sorry, but what does it have to do with the semicolon? AFAICS this is
> rather due to wxCHECK not being a single statement. It would be nice to
> avoid this but AFAIR we didn't find a way to make this work with all
> supported compilers the last time it was discussed.
> 
>  Anyhow, considering that there is a trivial workaround (just add braces) I
> don't think it's a huge problem.
> 
>  Regards,
> VZ

If you do not have the statement "struct something" in the wxCHECK macro 
a semicolon is not required after the wxCHECK macro. And the "struct 
something" statement only exists to force a semicolon after wxCHECK.

Hartwig






More information about the wx-users mailing list