www.digitalmars.com         C & C++   DMDScript  

c++.dos.32-bits - Concerning __FILE__ __FUNC__

reply "ZaitcevE.V." <Genior km.ru> writes:
Why at compilation of the following code:(sc test.cpp -mx -c -cpp)

void
kpdodebug(unsigned const char *, unsigned const char *, unsigned const char
*);

class efdat
    {
    private:
        char         *dat;
    public:
        int          rezbl;
        efdat()
            {
            kpdodebug(__FILE__, __FUNC__, __TIMESTAMP__);
            };
    };

The mistake is given out:
test.cpp(13) : Error: expression expected
--- errorlevel 1
Nov 21 2001
next sibling parent reply "Rajiv Bhagwat" <dataflow vsnl.com> writes:
A little testing shows that __FUNC__ is not defined for DMC. What is your
reasoning for assuming so? (Does it work for any other compiler?)
-Rajiv Bhagwat

ZaitcevE.V. <Genior km.ru> wrote in message
news:9tibih$1as3$1 digitaldaemon.com...
 Why at compilation of the following code:(sc test.cpp -mx -c -cpp)

 void
 kpdodebug(unsigned const char *, unsigned const char *, unsigned const

 *);

 class efdat
     {
     private:
         char         *dat;
     public:
         int          rezbl;
         efdat()
             {
             kpdodebug(__FILE__, __FUNC__, __TIMESTAMP__);
             };
     };

 The mistake is given out:
 test.cpp(13) : Error: expression expected
 --- errorlevel 1

Nov 22 2001
parent reply "Walter" <walter digitalmars.com> writes:
__FUNCTION__ is the one he's likely looking for.

    www.digitalmars.com/ctg/predefined.html



"Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
news:9tid72$1d54$1 digitaldaemon.com...
 A little testing shows that __FUNC__ is not defined for DMC. What is your
 reasoning for assuming so? (Does it work for any other compiler?)
 -Rajiv Bhagwat

 ZaitcevE.V. <Genior km.ru> wrote in message
 news:9tibih$1as3$1 digitaldaemon.com...
 Why at compilation of the following code:(sc test.cpp -mx -c -cpp)

 void
 kpdodebug(unsigned const char *, unsigned const char *, unsigned const

 *);

 class efdat
     {
     private:
         char         *dat;
     public:
         int          rezbl;
         efdat()
             {
             kpdodebug(__FILE__, __FUNC__, __TIMESTAMP__);
             };
     };

 The mistake is given out:
 test.cpp(13) : Error: expression expected
 --- errorlevel 1


Nov 22 2001
parent reply "Walter" <walter digitalmars.com> writes:
Ignore that last post of mine (!). __FUNC__ is defined and should work.


#include <stdio.h>

void main()
{
    printf("__FUNC__ = '%s'\n", __FUNC__);
}

prints:

__FUNC__ = 'main'

"Walter" <walter digitalmars.com> wrote in message
news:9tjfh0$2nmf$1 digitaldaemon.com...
 __FUNCTION__ is the one he's likely looking for.

     www.digitalmars.com/ctg/predefined.html



 "Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
 news:9tid72$1d54$1 digitaldaemon.com...
 A little testing shows that __FUNC__ is not defined for DMC. What is


 reasoning for assuming so? (Does it work for any other compiler?)
 -Rajiv Bhagwat

 ZaitcevE.V. <Genior km.ru> wrote in message
 news:9tibih$1as3$1 digitaldaemon.com...
 Why at compilation of the following code:(sc test.cpp -mx -c -cpp)

 void
 kpdodebug(unsigned const char *, unsigned const char *, unsigned const

 *);

 class efdat
     {
     private:
         char         *dat;
     public:
         int          rezbl;
         efdat()
             {
             kpdodebug(__FILE__, __FUNC__, __TIMESTAMP__);
             };
     };

 The mistake is given out:
 test.cpp(13) : Error: expression expected
 --- errorlevel 1



Nov 22 2001
next sibling parent Jan Knepper <jan smartsoft.cc> writes:
Walter wrote:

 Ignore that last post of mine (!). __FUNC__ is defined and should work.

You should be able to just 'cancel' them... Jan
Nov 22 2001
prev sibling parent "ZaitcevE.V." <Genior km.ru> writes:
mr.Wolter,
These macroconst I always use for debugging and all was good.
The mistake has arisen at use them in the designer of a class (it(he) enough
large).
I use the compiler: Digital Mars Compiler Version 8.0B7n


Walter <walter digitalmars.com>  
:9tji0g$2qs5$2 digitaldaemon.com...
 Ignore that last post of mine (!). __FUNC__ is defined and should work.


 #include <stdio.h>

 void main()
 {
     printf("__FUNC__ = '%s'\n", __FUNC__);
 }

 prints:

 __FUNC__ = 'main'

 "Walter" <walter digitalmars.com> wrote in message
 news:9tjfh0$2nmf$1 digitaldaemon.com...
 __FUNCTION__ is the one he's likely looking for.

     www.digitalmars.com/ctg/predefined.html


Nov 22 2001
prev sibling parent reply Jan Knepper <jan smartsoft.cc> writes:
"ZaitcevE.V." wrote:

 Why at compilation of the following code:(sc test.cpp -mx -c -cpp)

 void
 kpdodebug(unsigned const char *, unsigned const char *, unsigned const char
 *);

 class efdat
     {
     private:
         char         *dat;
     public:
         int          rezbl;
         efdat()
             {
             kpdodebug(__FILE__, __FUNC__, __TIMESTAMP__);
             };

I thing the ';' here is not supposed to be there isn't it???
     };

 The mistake is given out:
 test.cpp(13) : Error: expression expected
 --- errorlevel 1

As far as I know __FUNC__ works just fine... Jan
Nov 22 2001
parent "ZaitcevE.V." <Genior km.ru> writes:
Jan Knepper <jan smartsoft.cc>  
:3BFD4AE5.22BBAC5E smartsoft.cc...
 "ZaitcevE.V." wrote:

 Why at compilation of the following code:(sc test.cpp -mx -c -cpp)

 void
 kpdodebug(unsigned const char *, unsigned const char *, unsigned const


 *);

 class efdat
     {
     private:
         char         *dat;
     public:
         int          rezbl;
         efdat()
             {
             kpdodebug(__FILE__, __FUNC__, __TIMESTAMP__);
             };

I thing the ';' here is not supposed to be there isn't it??? As far as I know __FUNC__ works just fine... Jan

Jan it is a typing error in the message. The mistake arises at use in the designer of a class. Can check up.
Nov 22 2001