Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macro Debug #4

Open
tpopp opened this issue Feb 9, 2014 · 3 comments
Open

Macro Debug #4

tpopp opened this issue Feb 9, 2014 · 3 comments

Comments

@tpopp
Copy link
Collaborator

tpopp commented Feb 9, 2014

I typed up some macros so the same command could be used to for regular memory allocation or allocating and printing. This could be a possible solution to printing vs callbacks. I'm assuming this could cause some problems with debugging as far as line numbers, so I left it as a separate branch. running "make macro.dbg" includes the macros when compiling.

@wyager
Copy link
Collaborator

wyager commented Feb 9, 2014

I have kind of a natural aversion to using the preprocessor for very much. I feel like re-defining function names might be asking for trouble. Don't the Linux people force always using ALLCAPS for #defines to avoid such a situation?

@tpopp
Copy link
Collaborator Author

tpopp commented Feb 9, 2014

They might always use all caps. I just typed it up real quick and pushed it as a separate branch. It works and there's only three functions, so I wouldn't be too worried about it, but then again, I've never experienced the horrors that occur from using macro's.

@witchel
Copy link
Owner

witchel commented Feb 9, 2014

Yeah, I have used the preprocessor to change the definition of
functions, but it is a dangerous game and one to be avoided if possible.
You can use LD_PRELOAD to replace a malloc library in a more clean way.

I have to say, I'm not crazy about the printf and python script as a
memory debug methodology. valgrind is a far more developed and
worthwhile tool.

valgrind --tool=memcheck --leak-check=full ./test input

On 2/9/2014 12:31 PM, Tres wrote:

They might always use all caps. I just typed it up real quick and pushed
it as a separate branch. It works and there's only three functions, so I
wouldn't be too worried about it, but then again, I've never experienced
the horrors that occur from using macro's.


Reply to this email directly or view it on GitHub
#4 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants