Author Topic: which macro is defined for line number in codeblock  (Read 3808 times)

Offline shiki

  • Single posting newcomer
  • *
  • Posts: 6
which macro is defined for line number in codeblock
« on: March 30, 2012, 10:02:55 am »
the line number is used to trace where the something happens. Is there any macro or function like that?
And how to get the current file name when program runs?
« Last Edit: March 30, 2012, 10:24:40 am by shiki »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: which macro is defined for line number in codeblock
« Reply #1 on: March 30, 2012, 11:21:54 am »
C/C++ macro or a macro in C::B's marco expansion rules?

(For the C/C++, you've asked at the wrong forum and the topic will be lock)
Here they are: __LINE__, __FUNCTION__, __FILE__

p.s. search the net is the faster option most of the time.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline shiki

  • Single posting newcomer
  • *
  • Posts: 6
Re: which macro is defined for line number in codeblock
« Reply #2 on: March 30, 2012, 11:24:00 am »
its should be OK now. When using GCC , these pre-defined macro are useful : __FILE__,__FUNCTION__,__LINE__
I misunderstood the compiler and the IDE . Under windows, when using vs, there is a little bit moment notice the compiler.

Offline shiki

  • Single posting newcomer
  • *
  • Posts: 6
Re: which macro is defined for line number in codeblock
« Reply #3 on: March 30, 2012, 11:28:27 am »
C/C++ macro or a macro in C::B's marco expansion rules?

(For the C/C++, you've asked at the wrong forum and the topic will be lock)
Here they are: __LINE__, __FUNCTION__, __FILE__

p.s. search the net is the faster option most of the time.

Thanks very much, This is what i need.