[Development] QDateTime is missing shared null optimization

Marc Mutz marc.mutz at kdab.com
Mon Aug 3 11:55:10 CEST 2015


On Friday 31 July 2015 18:08:13 Thiago Macieira wrote:
> I also don't think you can have a full, static shared null because 
> QDateTimePrivate is not POD, due to its QTimeZone member. So a real shared 
> null would be a Q_GLOBAL_STATIC, if you chose to go that route.

You can always make a layout-compatible POD and cast from that. The QTimeZone 
pointer _can_ be nullptr, iirc. Or even inherit from the POD, to be extra safe 
(less duplication, but then you need to cast the QString and QTimeZone members 
on every access).

-- 
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts



More information about the Development mailing list