Boost logo

Boost :

Subject: Re: [boost] String literals concatenation issue when usingBOOST_CURRENT_FUNCTION
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-01-16 10:40:24


----- Original Message -----
From: "vicente.botet" <vicente.botet_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Saturday, January 16, 2010 4:37 PM
Subject: [boost] String literals concatenation issue when usingBOOST_CURRENT_FUNCTION

Hi,

I want to define a macro as
#define BOOST_CHRONO_DIGITAL_TIME_FORMAT(F) "\n" F " tokes %d day(s) %h:%m:%s.%n\n"
#define BOOST_CHRONO_DIGITAL_TIME_FUNCTION_FORMAT BOOST_CHRONO_DIGITAL_TIME_FORMAT(BOOST_CURRENT_FUNCTION)

I have a compile error with gcc(3.4.4 or 4.4.0) (Boost v1.41) in the following sentence

    const char* c= "\n" BOOST_CURRENT_FUNCTION " %d day(s) %h:%m:%s.%n\n";

C:\cygwin\boost_1_41_0\libs\chrono\example\digital_time_example.cpp: In function `int f1(long int)':
C:\cygwin\boost_1_41_0\libs\chrono\example\digital_time_example.cpp:24: error: expected `;' before "__PRETTY_FUNCTION__"

as well as
    const char* c= "\n" __PRETTY_FUNCTION__ " %d day(s) %h:%m:%s.%n\n";

The same code works as I expected with MSVC.

The following code works well with gcc
    const char* c= "\n" "f" " %d day(s) %h:%m:%s.%n\n";
    const char* c2= BOOST_CURRENT_FUNCTION;

as well as this one

    const char* c= "\n" __FILE__" %d day(s) %h:%m:%s.%n\n";

Is there something wrong? Does gcc manage __PRETTY_FUNCTION__ and __FILE__ differently? Does someone knows a workaround?

Best,
_____________________
Vicente Juan Botet Escribá
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

With __FUNCTION__ doesn't works neither.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk