gcc - How to print input c++ function parameter values automatically -


I was wondering if there is a macro or standard way (for debugging purposes) to automatically print the value of the parameter Function F, such as __ function___ function shows signature / print for? For example,

  void foo (int x, string y) {cout & lt; & Lt; __FUNCTIION_ARGS__ & lt; & Lt; Endl; }   

to show values ​​of x and y .

If there is no such magic in a standard way, is it possible to write a macro / template to do this?

- Update -

Copy @ xxh, it is impossible to print inside the function in question: it is possible to automate it on the macro / template, collar side: < / P>

  call (foo, x, y);   

which prints each parameter value, and foo (x, y) as as it directly identifies every other aspect ? If a value is not printable (such as pointers, functions), wrapper calls can only print an opaque value such as & lt; Ptr & gt; or & lt; Noprint & gt; .

Thank you

PS I am using GCC, (and also lying in the future).

Take it on me:

  #include   

Output:

  Ultimate: Hello 3.14 42 Hello 3.14 42 57   

Various templates are fun!

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -