Fix imperial cylinder sizes in equipment tab

Thiago Macieira thiago at macieira.org
Fri Jan 3 04:31:40 UTC 2014


On quinta-feira, 2 de janeiro de 2014 21:36:01, Linus Torvalds wrote:
> This seems to fix it from quick testing. I'd love to make the "mbar"
> be a proper "pressure_t" rather than an unsigned int, but setting
> default values for arguments with complex types is a fairly recent
> thing, so compilers don't support it or require magic compile-time
> flags to enable it or at least not complain about it.

Indeed. For

typedef struct {
        int mbar;
} pressure_t;

If you want to pass a default argument of type pressure_t, then that struct 
requires a constructor for it to work in C++98. It would need to be:

struct pressure_t {
	int mbar;
	pressure_t(int m) : mbar(m) {}
};

However, C++11 does have a new feature called "uniform initialisation" which 
is probably what Linus is referring to. That would allow:

QString get_volume_string(volume_t volume, bool showunit = false, pressure_t 
mbar = {});

GCC's C++11 support has supported this since 4.4, Clang since 3.1, the Intel 
compiler since 13.0 and MSVC since 2013.

Turning C++11 on for Subsurface would destroy support for OS X less than 10.6 
since only GCC 4.2 can compile for it.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20140103/b800c167/attachment.sig>


More information about the subsurface mailing list