Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

IDE with advanced code analysis?

Name: Anonymous 2016-02-21 11:23

/prog/, what's the IDE with the most advanced code analysis features out there? I'm talking about things like:

- listing all the free variables that occur in selected code term
- warning the user when he shadows a binding from the outer scope
- finding all the places where a variable gets mutated
- showing all possible execution paths through a code term

Name: Anonymous 2016-08-29 13:52

>>41
I have yet to encounter a problem with function-like macros that can't be solved by wrapping the arguments in parentheses, and doing the same to the entire expression. And as mentioned above, functions ARE the better choice for anything that requires local variables, but for things that don't, macros are usually the better choice.

For example, to cube a number, you could use

int cube(int n) {
return n*n*n;
}


but there's no point in having n be a local variable, since it's not modified.

#define CUBE(n) ((n)*(n)*(n))

would probably be more suitable in this instance, since it wouldn't copy anything into a local variable. Depending on how many times it's used, it might result in a larger binary, but usually reducing memory usage is more important than reducing binary size. Additionally, the macro version would allow the compiler to automatically generate code appropriate for the type of n, while a function would be explicitly typed and require casting or force the programmer to create a different version for each type.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List