Posts

Showing posts from January 13, 2019

Paretstortes

Image
Paretstortes Peyrestortes Portal (el Porxo) i carrer de Paretstortes Localització 42° 45′ 15″ N, 2° 51′ 06″ E  /  42.754166666667°N , 2.8516666666667°E  / 42.754166666667; 2.8516666666667 Estat França Regió Occitània Departament Pirineus Orientals Districte Districte de Perpinyà Cantó Cantó de la Costa Salanquesa Població Total 1.341 (2015) • Densitat 168,47 hab/km² Gentilici Parestortenc, parestortenca Geografia Superfície 7,96 km² Altitud 35 m Limita amb Espirà de l'Aglí Ribesaltes Perpinyà Sant Esteve del Monestir Baixàs Organització política • Batle Henri Baptiste Identificador descriptiu Codi postal 66600 Zona horària UTC+01:00 UTC+02:00 Situació de la comuna de Paretstortes en el Rosselló Paretstortes (popularment [pəɾəs'toɾtəs] o [pəjɾəs'toɾtəs] , en francés Peyrestortes ) és un poble, cao de la comuna del mate...

Does the C++ standard allow for an uninitialized bool to crash a program?

Image
325 76 I know that "undefined behaviour" in C++ can pretty much allow the compiler to do anything it wants. However, I had a crash that surprised me, as I would have assumed the code looked safe enough. In this case, the real problem happened only on a specific platform using a specific compiler, and only if optimization were enabled. I tried several things in order to reproduce the problem and simplify it to the maximum. Here's an extract of a function called Serialize, that would take a bool parameter, and copy the string "true" or "false" to an existing destination buffer. Would this function be in a code review, there would be no way to tell that it, in fact, could crash if the bool parameter was an uninitialized value. // Zero-filled global buffer of 16 characters char de...