yse / easy_profiler

Lightweight profiler library for c++
MIT License
2.15k stars 184 forks source link

EASY_END_BLOCK doesn't support function syntax #139

Closed mathieumallet closed 5 years ago

mathieumallet commented 5 years ago

Currently, EASY_END_BLOCK calls cannot use function syntax. For example the following fails to compile:

EASY_BLOCK("Foo");
Foo();
EASY_END_BLOCK();

image

Currently, the following is required instead:

EASY_BLOCK("Foo");
Foo();
EASY_END_BLOCK;

This differs from other macros such as EASY_FUNCTION(); which allows being called with empty parenthesis. For ease of use, EASY_END_BLOCK should support being called with empty parenthesis.

cas4ey commented 5 years ago

Hi @mmallet-youilabs

The macro EASY_FUNCTION() has parenthesis because it has optional input args.
EASY_END_BLOCK does not since it has no input args at all.

However, it is not very good idea to change API which is currently in use. We could create additional macro with parenthesis, but I think it would be better if you will do it on your own by defining/redefing this macro for your project individually.

mathieumallet commented 5 years ago

That’s fair :) I didn’t know if it was possible to support parenthesis and no parenthesis at the same time.