Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Error when adding a new file (to a project)

<< < (3/4) > >>

thomas:
Yup, the offender is in 688:

--- Code: ---key.Printf(_T("/default_code/%d"), (int)FileTypeOf(ed->GetFilename()));
--- End code ---

thomas:

--- Quote from: Ceniza on November 21, 2005, 09:53:10 pm ---editorconfigurationdialog.cpp lines 532 and 536
--- End quote ---
Those two were fixed ~15 mins ago, and the third is now too. Update and try again.

Urxae:

--- Quote from: thomas on November 21, 2005, 09:47:00 pm ---I really wish there was something like __FILE__, __LINE__, or __FUNCTION__  which we could use. But we would need something like __CALLING_FUNCTION__.
I don't know of any such thing, is there? If there is, I could just add it to the exception, and you would know *exactly* where to look.

--- End quote ---

If I recall correctly, defaulted arguments are evaluated at the place a function is called. This means that if you add extra arguments defaulting to __FILE__, __LINE__, or __FUNCTION__ you should get their values at the call site.

thomas:
Unluckily does not work  :(


--- Code: ---#include <stdio.h>

void func(const char* x = __FUNCTION__);

int main()
{
func();
return 0;
}

void func(const char *x)
{
printf("called from %s", x);
}
--- End code ---

called from
Press ENTER to continue.



--- Code: ---#include <stdio.h>

void func(int x = __LINE__);

int main()
{
func();
return 0;
}

void func(int x)
{
printf("called from %d", x);
}
--- End code ---

called from 3
Press ENTER to continue.

Not what we need.

Urxae:

--- Quote from: thomas on November 21, 2005, 10:40:55 pm ---Unluckily does not work  :(

--- End quote ---

Maybe I misremembered then, that or there's a bug in gcc.
Well, if the function has a unique name you could use an ugly :? wrapper macro to add the extra arguments:

--- Code: ---#include <stdio.h>

void func(const char* x)
{
printf("called from %s", x);
}
#define func() func(__FUNCTION__)

int main()
{
func();
return 0;
}

--- End code ---
which works, but as mentioned you better hope no client code uses other functions/classes/variables with the same name.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version