#20 c++ specific keyword used in rollingpolicy.h header file

closed-fixed
nobody
None
5
2012-09-30
2009-01-25
Piotr Orchowski
No

While mixing c++ with c and using log4c tool, including
#include<log4c.h> header file gives errors while compiling user projects with following errors:

make
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I. -o main.o main.cpp
/usr/local/include/log4c/rollingpolicy.h:55: error: expected ‘,’ or ‘...’ before ‘this’
/usr/local/include/log4c/rollingpolicy.h:60: error: expected ‘,’ or ‘...’ before ‘this’
/usr/local/include/log4c/rollingpolicy.h:122: error: expected ‘,’ or ‘...’ before ‘this’
/usr/local/include/log4c/rollingpolicy.h:188: error: expected ‘,’ or ‘...’ before ‘this’
/usr/local/include/log4c/rollingpolicy.h:191: error: expected ‘,’ or ‘...’ before ‘this’
/usr/local/include/log4c/rollingpolicy.h:192: error: expected ‘,’ or ‘...’ before ‘this’
/usr/local/include/log4c/rollingpolicy.h:195: error: expected ‘,’ or ‘...’ before ‘this’
make: *** [main.o] Error 1
====
Note: gcc compiler does not produces those errors.
====

Fix description:
This is a C++ keyword, thus it seems that is a simple change in rollingpolicy.h header
to avoid of using 'this' as below:

int (*init)(log4c_rollingpolicy_t *this, rollingfile_udata_t* rfudatap );

changing '*this' to something like '*_this' resolves all compilation problems.

Rg's
PO

Discussion

    • status: open --> closed-fixed
     
  • Fixed in log4c 1.2.1.