A list for the developers of CellML tools

Text archives Help


[cellml-dev] FW: r1791 - simple_interface_generators/trunk/glue/xpcom


Chronological Thread 
  • From: ak.miller at auckland.ac.nz (Andrew Miller)
  • Subject: [cellml-dev] FW: r1791 - simple_interface_generators/trunk/glue/xpcom
  • Date: Wed, 26 Sep 2007 19:51:24 +1200

Randall Britten wrote:
> To Andrew
>
> I think #include <cstdio> is preferred style, since then printf etc are in
> namespace std.
>

printf is ANSI C whereas cstdio is only in ISO/ANSI C++. The informal
(which I eventually plan to write up) style is to use ANSI C headers
where they exist to minimise any efforts to port parts of the code which
don't use C++ features between C and C++. This is a policy which we
could review if, for example, we wanted to use conflicting names and
benefit from namespaces.

If we do this, this is far from the only place we would have to change.

> Also, wouldn't exit(EXIT_FAILURE) or abort() be preferable?
>
Exit is a bad idea because we want a crash report in applications which
support this.

abort is an alternative option, although it is not quite as portable (it
is in C99 and POSIX, although some older platforms might struggle with
this).
> Regards,
> Randall
>
> -----Original Message-----
> Subject: r1791 - simple_interface_generators/trunk/glue/xpcom
>
>
> Modified: simple_interface_generators/trunk/glue/xpcom/P2XFactory.hxx
> ===================================================================
> --- simple_interface_generators/trunk/glue/xpcom/P2XFactory.hxx
> 2007-09-24
> 22:56:55 UTC (rev 1790)
> +++ simple_interface_generators/trunk/glue/xpcom/P2XFactory.hxx
> 2007-09-26
> 01:51:51 UTC (rev 1791)
> @@ -5,6 +5,7 @@
> #define XPCOMSUPPORT_PRE CDA_IMPORT_PRE
> #define XPCOMSUPPORT_POST CDA_IMPORT_POST
> #endif
> +#include <stdio.h>
>
> class P2XFactory
> {
> @@ -25,10 +26,30 @@
> {
> nsCString cs(aName);
> if (mEntries == nsnull)
> + {
> + printf("Serious problem with XPCOM bridge: P2XFactory::FindFactory "
> + "called but mEntries is null.\n");
> + char* x = NULL;
> + // Deliberate null deref to ensure we crash here even in production
> mode
> + // because we will crash later in any case and this will result in a
> more
> + // useful error report.
> + x[0] = 0;
> return nsnull;
> + }
>
> Etc.
>
> _______________________________________________
> cellml-tools-developers mailing list
> cellml-tools-developers at cellml.org
> http://www.cellml.org/mailman/listinfo/cellml-tools-developers
>





Archive powered by MHonArc 2.6.18.

Top of page