[pet] PET style guide proposal
Mülner, Helmut
helmut.muelner at joanneum.at
Fri Jun 18 17:19:17 CEST 2010
Hi, pet developers,
I recently got interested in pet and started porting it to the Windows platform.
In a first step I used cygwin/gcc and managed to compile and run flop and cheap
with the exception of ECL (so I configured --with-ecl=no) using the GG grammar.
Porting to the Microsoft Compilers was a little more difficult.
There was a portability bug in chart.h that took me some time to find:
My corrected implementation of chart_iter_adj_active::valid() now is:
inline bool valid()
{
if (at_start && curr == LI_start.end()) {
overflow();
}
if (at_start) {
return true;
}
return curr != LI_end.end();
}
In the original version curr could be an iterator of LI_start and was
always compared to LI_end.end(). This is illegal in C++ and is asserted
by the MS compiler.
The forallint macro also contained an error: it dereferencd the end-iterator.
To increase protability I used several boost libraries:
foreach, format, date_time, lexical_cast, algorithm/string, filesystem,
program_options.
I also converted goofy to qt4 (not yet finished).
Then I got carried away a little by my enthusiam: I eliminated salloc and malloc,
sprintf, strupper, strcasecompare etc.
Instead of ICU I used QString from the Qt libraries, for compiling I generated *.pro files.
I also did some profiling and discovered that flop spends more than 50% of its time in strtod.
(Are floating point numbers really possible in TDL?)
>
> I added a ProgrammingStyleGuide Wiki page to pet.opendfki.de.
> The content stems from the Google style guide and other
> sources, only very little of it are my own ideas and opinions.
>
I also changed a lot of names in accordance to the new programming style guides. ;-)
If anybody is interested I can provide a git repository with my changes or upload to
a branch in the svn repository.
Greating from Austria,
Helmut Mülner
Institute of Information Systems
JOANNEUM RESEARCH Forschungsgesellschaft mbH
Steyrergasse 17, 8010 Graz, AUSTRIA
phone: +43-316-876-2612
fax: +43-316-876-1403
personal fax: +43-316-8769-2612
web: http://www.joanneum.at/iis
e-mail: helmut.muelner at joanneum.at
More information about the pet
mailing list