Shorthand macros and the debugger 
Author Message
 Shorthand macros and the debugger

Hi!

I think I know the answer to this question, I just want to see if there is
something I have overlooked...

We are using preprocessor macros as typing shorthands. For example, where
we might have

        if (m_stuff->m_dataTable[m_currentIndex] == something)
                {
                m_stuff->m_dataTable[m_currentIndex] = 0;
                }

instead we have

        #define CURRENT_DATA    m_stuff->m_dataTable[m_currentIndex]

        if (CURRENT_DATA == something)
                {
                CURRENT_DATA = 0;
                }

This is much easier to read and not as prone to typing errors.

The problem is that the Visual Studio de{*filter*} doesn't (appear to) know how
to translate "CURRENT_DATA" to its expansion. If I highlight CURRENT_DATA
in the editor window when the de{*filter*} is active, the machines just stares
at me. If I right click (while CURRENT_DATA is highlighted) and select
quickview the de{*filter*} tells me that it doesn't know what to do with
"CURRENT_DATA".

This is not terribly surprising, but it is certainly an annoyance. The
shorthand macros are handy, but if you can't use them in the de{*filter*} their
value quickly diminishes.

Am I missing something?

Thanks!

--- Tom

TA Software Systems
C{*filter*}tesville, VA, USA



Mon, 20 May 2002 03:00:00 GMT  
 Shorthand macros and the debugger
There is no debug information generated for macros - thus the de{*filter*}
cannot display them - You're going to have to live with this one.


Quote:
> Hi!

> I think I know the answer to this question, I just want to see if there is
> something I have overlooked...

> We are using preprocessor macros as typing shorthands. For example, where
> we might have

> if (m_stuff->m_dataTable[m_currentIndex] == something)
> {
> m_stuff->m_dataTable[m_currentIndex] = 0;
> }

> instead we have

> #define CURRENT_DATA m_stuff->m_dataTable[m_currentIndex]

> if (CURRENT_DATA == something)
> {
> CURRENT_DATA = 0;
> }

> This is much easier to read and not as prone to typing errors.

> The problem is that the Visual Studio de{*filter*} doesn't (appear to) know
how
> to translate "CURRENT_DATA" to its expansion. If I highlight CURRENT_DATA
> in the editor window when the de{*filter*} is active, the machines just stares
> at me. If I right click (while CURRENT_DATA is highlighted) and select
> quickview the de{*filter*} tells me that it doesn't know what to do with
> "CURRENT_DATA".

> This is not terribly surprising, but it is certainly an annoyance. The
> shorthand macros are handy, but if you can't use them in the de{*filter*}
their
> value quickly diminishes.

> Am I missing something?

> Thanks!

> --- Tom

> TA Software Systems
> C{*filter*}tesville, VA, USA



Mon, 20 May 2002 03:00:00 GMT  
 Shorthand macros and the debugger

Quote:

> We are using preprocessor macros as typing shorthands. For example, where
> we might have

>         if (m_stuff->m_dataTable[m_currentIndex] == something)
>                 {
>                 m_stuff->m_dataTable[m_currentIndex] = 0;
>                 }

> instead we have

>         #define CURRENT_DATA    m_stuff->m_dataTable[m_currentIndex]

>         if (CURRENT_DATA == something)
>                 {
>                 CURRENT_DATA = 0;
>                 }
> This is much easier to read and not as prone to typing errors.

May I suggest you use the features of the language:

        CStuff& current = m_stuff->m_dataTable[m_currentIndex];

        if (current == something)
        {
                current = 0;
        }

This seems as easy to handle; additionally, the de{*filter*} will know what
you are doing.

Christian.

--
Christian Luginbuehl



Tue, 21 May 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. shorthand way to do || (or)

2. Stepping into macros with debugger

3. Debugger control by macro

4. Expanding the values of macros during a build or in the debugger

5. Stepping into macros with debugger

6. VC Macro command Debugger.State

7. PLEASE HELP: I AM NEW TO DEBUGGER (Turbo Debugger 3.0)

8. Debugger vs. not debugger difference

9. Debugger question - debugger came up in assembly

10. Macro problem (new lines in macros?)

11. Building Macros out of Macros

12. #define a macro to be another macro?

 

 
Powered by phpBB® Forum Software