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

Pages: 1-4041-8081-

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-02-21 11:24

emacs

Name: Cudder !cXCudderUE 2016-02-21 11:44

Your brain.

Name: Anonymous 2016-02-21 12:23

Emacs

Name: Anonymous 2016-02-21 12:39

Isn't a report for each of these features going to take longer to grok than simply figuring it out by yourself?

Name: Anonymous 2016-02-21 12:43

>>5
No.

>>4
I'm a woman, I don't have any.

Name: Anonymous 2016-02-21 12:44

>>6
Citation needed, mothafuckaaaaa!

Name: Anonymous 2016-02-21 13:22

>>7
Very often I need to take a chunk of code and make it into a separate function. Going through the code and checking what free vars there are to make them all into function parameters would be a chore, might as well rewrite it from scratch. An IDE could help a lot here.

Name: Anonymous 2016-02-21 14:51

>>8
Write smaller functions. If you're too stupid to do that, split your chunk into its own function anyway and then deal with the unbound variables.

Name: Anonymous 2016-02-21 15:19

>>9
split your chunk into its own function anyway
That's what I would like to do. Is there an IDE smart enough to help me?

Write smaller functions
You're another idiot who mindlessly applies "design patterns" regardless of whether they're appropriate or not.

Name: Anonymous 2016-02-21 15:34

>>10
Is there an IDE smart enough to help me?
Yes, Notepad can do this. You select the lines you want to put into a function, hit Ctrl-X, move the cursor out of the function, and then hit Ctrl-V. You will have to write a function signature around it, though. Then all of your code-specific tools (including your IDE -- the above steps are not specific to Notepad!) will show you where the free variables in your new function are.

Alternatively, all of the top DDG search results for "ide refactor" which mention a specific IDE give you step-by-step instructions on how to do what you are trying to do.

"design patterns"
Bzzt! Wrong again! Explain how, exactly, "write smaller functions" is a "design pattern", because it just sounds like common fucking sense to me.
Perhaps you are not using a language particularly conducive to writing small helper functions in order to break down your problem into its component parts?

Name: Cudder !cXCudderUE 2016-02-21 15:36

>>11
Perhaps you are not using a language particularly conducive to writing small helper functions in order to break down your problem into its component parts?

Or how about just writing it all in one place so you don't have to jump all over the fucking file(s) to figure out how it works?

Name: Anonymous 2016-02-21 15:39

>>11
What I'm trying to say, >>10, is that you should just stick with today's special.
If moving a chunk of code into its own function is a daunting task to you, then there's something wrong with either you or your code that a magical IDE will not help you with.

Name: Anonymous 2016-02-21 15:43

>>12
That's why you write the functions next to each other, asshole. Do you order your functions alphabetically or something?

Name: Anonymous 2016-02-21 17:56

>>12
This, exactly. Functions don't need to be small. The purpose of a function is reusability and abstraction boundaries, not splitting code into small chunks which only makes it harder to read code.

Name: Anonymous 2016-02-21 17:57

>>13
It's not a daunting task, it's a chore that I'd like automatized so I can do it instantly. Notepad won't help because it won't write the function arguments for me.

Name: Anonymous 2016-02-21 18:03

>>6
Women are not allowed anywhere near the Emacs!

Name: Anonymous 2016-02-21 18:09

>>15
Code is meant to be read. Make it readable. That is the only thing that should guide function size.
Modules, not functions, are for abstraction boundaries and reusability.

Name: Anonymous 2016-02-21 18:55

>>18
You haven't even heard that a function may be called in two places, have you?

Name: Anonymous 2016-02-21 19:10

>>19
Read the rest of the thread before you start moving the goalposts.

Name: Anonymous 2016-02-21 20:31

>>20
When someone says that functions are not for reusability, that's a miss no matter where the goalposts are. It's just plain wrong.

Name: Anonymous 2016-02-21 20:54

So to sum up the thread, in 2016 there is not a single IDE in the world advanced enough to understand what free variables, scopes or execution paths are.

Name: Anonymous 2016-02-21 20:59

>>21
You are talking past yourself. There is a difference between reusability on the module level and reduction of duplication within each module. You started out in >>15 on the former, and stumbled over to the latter in >>19,21.

Modules are the unit of reuse and abstraction, and what is a module if not a collection of functions and types? (You cannot reuse a function from outside of a module without also requiring the types the function operates over, also within that module. Thus, you cannot pull an arbitrary function out of a module; you must use the module in its entirety.)

Name: Anonymous 2016-02-21 21:00

>>22
Save the summary until >>999 please!

Name: Anonymous 2016-02-21 21:04

>>22
emacs

Name: Anonymous 2016-02-21 21:19

>>24
YOU MENA >>1001

Name: Anonymous 2016-02-24 20:28

>>24,26
U MENA >>1111

Name: Anonymous 2016-08-28 4:40

Write smaller functions
This is bad advice. Smaller functions means MORE functions, and each function regardless of size has some fixed overhead in code generated and space allocated on the stack. This is the problem with ``design patterns" and ``maintainable code"; in writing code that can be easily understood and modified by idiot programmers, you make it harder for the compiler to generate efficient machine code. Even the best optimizing compilers can't match the quality of hand-written assembly, confusing them with unnecessary function calls is just going to make things worse. At the very least, you should use macros or inline functions, to avoid the overhead of a function call.

Name: Anonymous 2016-08-28 6:18

Check em

Name: Anonymous 2016-08-28 6:40

Programmer's Notepad

Name: Anonymous 2016-08-28 10:11

>>28
Programmer time is more expensive than computer time in the vast majority of computer applications. Maintainable, extendible and composible code is normally more desired by the people paying the programmers than minuscule improvements in CPU time.

Name: Anonymous 2016-08-28 10:33

Programmer time is expensive
Sir, this is not true anymore

Name: Anonymous 2016-08-28 11:02

Check em

Name: Anonymous 2016-08-29 1:52

>>28
each function regardless of size has some fixed overhead in code generated and space allocated on the stack
in writing code that can be easily understood and modified by idiot programmers, you make it harder for the compiler to generate efficient machine code.

You're a shithead locked into Cudder-level dicking around with C. None of this is true for a recompiling JITted language.

Even the best optimizing compilers can't match the quality of hand-written assembly,

False for anything but stupid microbenchmarks. Compilers can match Real Work to the processor better than you can.

confusing them with unnecessary function calls is just going to make things worse.

You really don't know anything, you fucking moron. Die.

Name: Anonymous 2016-08-29 2:28

None of this is true for a recompiling JITted language.

Compilation is always going to be a computationally intensive task. JIT compilation means you're either going to have to deal with a compilation delay at startup, or turn off/reduce optimization to allow your code to be JIT-compiled quickly. Besides, JIT compilation isn't even done with most languages - most are either distributed as pre-compiled binaries, or interpreted. JIT is the exception, rather than the rule.

False for anything but stupid microbenchmarks. Compilers can match Real Work to the processor better than you can.

Okay, if you're talking about the average programmer, who doesn't understand low-level programming. But that's kind of like a self-fulfilling prophecy - the reason the average programmer can't write good assembly is because for the last forty years we've been training them to focus on learning how to write good high-level code, and letting the compiler worry about the low-level detail. But in all honesty, where compiled HLL beats hand-written assembly is in speed, not quality. An assembly programmer might be able to write very highly optimized code, but it will take them 8 days, and 2 days to write unoptimized assembly code. While the compiler's output isn't as highly optimized as what the assembly programmer can do, it's considered worthwhile since the time is much less (30 seconds or so).

You really don't know anything, you fucking moron. Die.
Compilers are still fairly limited in the circumstances under which they can optimize away unnecessary function calls (e.g. TCO). When output of a function call is passed to another function, that means both functions' local variables will need to be allocated on the stack, even if both functions have local variables that refer notionally to the same object. This is where macros have an advantage - they have the same syntax as functions, and are equally useful in breaking down a complex computation into smaller parts, but don't instruct the compiler to construct a stack frame. Functions do make sense in cases where making separate local variables are called for by the algorithm (say you want to repeat some action n times, without changing the value of n, so the logical way of doing this is copying n into i and doing while(i--). This could be done either as
#define REPEAT(n) (int i = n; while(i--) dosomething)
or
void repeat(n) {
while(n--) dosomething;
}

In this case the function is better, because you need a "local variable" in either case, and the function deallocates the local variable as soon as it's done with it, which the macro does not.)

Name: Anonymous 2016-08-29 5:07

JIT languages with ridiculously thorough recompilers include Java and JavaScript. The languages may be shit, but the compilers rock and these aren't some "exception" languages.

And holy fuck, stop thinking the world is as fucking stupid as C.

Name: Anonymous 2016-08-29 5:10

>>35
#define repeat(N) for(int i=N;i--;)
variables in scope of for loop exist only within the loop.
https://stackoverflow.com/questions/7880658/what-is-the-scope-of-a-while-and-for-loop

Name: Anonymous 2016-08-29 5:12

>>35
This is where macros have an advantage - they have the same syntax as functions
C macros barely have syntax at all, and the unfathomable uselessness of your example belies your inadequacy in even understanding C.

Name: Anonymous 2016-08-29 5:14

Example for >>37
repeat(60) a_state=refresh()?1:r_1();
converts to
for(int i=60;i--;) a_state=refresh()?1:r_1();

Name: Anonymous 2016-08-29 5:42

>>38
Syntax as in the general pattern of functionname(arg1,arg2). I don't know what you mean by saying they "barely have syntax at all", because the main difference from functions as far as source code syntax is concerned is that macros are typeless. It is necessary to write macros in different syntactical styles (such as by surrounding arguments with parentheses in the expanded form, to avoid things like:

#define TIMES_TWO(n) n*2

int a = TIMES_TWO(2 + 7) /* value stored in a is 16, not the expected 18 */

)
But that doesn't mean it makes sense to say they don't have syntax.

Name: Anonymous 2016-08-29 5:54

>>40
You're just talking about the function invocation syntax, which yeah sort of looks like a function call syntax. But it's a blind text substitution with a completely separate, gimped language. It totally fucks up the syntax and semantics of the caller, unless you go through pains to wrap everything in your macro expansion properly, and even then you'll always end up hitting weird situation where the fucking blind text substitution doesn't quite do what you want because there's no actual syntax at work.

Name: Anonymous 2016-08-29 5:54

You're just talking about the function invocation syntax
*Macro* invocation syntax. Fuck, your stupidity is wearing off on me!

Name: Anonymous 2016-08-29 5:55

Macros are in fact orders of magnitude more powerful than functions:
http://s11.zetaboards.com/frozenbbs/topic/11177313/1/

Name: Anonymous 2016-08-29 8:00

██████████ ████ ████ ███████████ ██████████ ████ ████ ███████████ ███████████
██████████ ████ ████ ███████████ ██████████ ████ █████ ███████████ ███████████
████ ████ ████ ████ ████ ████ ████ ████ ███████████
████ ████ ████ ████ ████ ████ ████ ████ ██ ███ ██
████ ██████████████ ███████████ ████ █████████ ███████████ ██ ███ ██
████ ██████████████ ███████████ ████ █████████ ███████████ ██ ███ ██
████ ██████████████ ████ ████ ████ ████ ████ ██ ███ ██
████ ████ ████ ████ ████ ████ ████ ████ ██ ███ ██
██████████ ████ ████ ███████████ ██████████ ████ █████ ███████████ ██ ███ ██
██████████ ████ ████ ███████████ ██████████ ████ ███ ███████████ ██ ███ ██

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.

Name: Anonymous 2016-08-29 13:58

>>45
CUBE(f()) computes f 3 times.

use functions instead of macros, the compiler can inline them.

Name: Anonymous 2016-08-29 14:01

#define CUBE(n) ({typeof(n) result=n;result*result*result})
Problem solved

Name: Anonymous 2016-08-29 14:04

>>46
Only an issue if superfluous CPU usage is considered worse than superfluous memory usage.

Name: Anonymous 2016-08-29 14:08

>>47
GCC has extension __auto_type
#define CUBE(n) ({__auto_type result=n;result*result*result})

Name: Anonymous 2016-08-29 14:08

>>46
>>48
Also, isn't this a case where the compiler can optimize anyway? If, without using macros or functions, I just write int x = f(6) * f(6) * f(6), wouldn't the compiler be smart enough to recognize that it only needs to calculate f(6) once? And while it's still in the register after being returned from function f(), just multiply by three before storing it in x?

Name: Anonymous 2016-08-29 14:20

>>50
Only if f() is trivial enough to be inlined and doesn't have side-effects. This optimization is:
https://en.wikipedia.org/wiki/Common_subexpression_elimination

Name: Anonymous 2016-08-29 14:22

>>47
This macro works (if I add a semicolon after the final occurrence of "result"), but I'm not sure I understand why. result*result*result doesn't store its value anywhere, yet if the macro is used as an argument to say printf(), it does in fact print the cube of the input. So how can the function-like macro "return" this value, if it's not stored in a variable? Does this depend on undefined behavior?

Name: Anonymous 2016-08-29 14:25

Name: Anonymous 2016-08-29 17:42

>>45
Your understanding and explanations of computing are grade-school level. Come back when you've done anything beyond the basics.

Name: Anonymous 2016-08-29 17:42

(this space intentionally left as a fuck you)

Name: Anonymous 2016-08-30 3:29

Wow people in this thread are not nice at all. What crawled up all your asses?

Name: Anonymous 2016-08-30 3:58

>>54
Please elaborate.

Name: Anonymous 2016-08-30 7:29

>>57
The faggot in question only perceives software architecture as bound to C style compilation. In other words, he's still in the baby crib of computing.

Name: Anonymous 2016-08-30 11:12

>>58
Compilation is still the only practical way to achieve optimal runtime performance.

Name: Anonymous 2016-08-30 16:33

>>59
Obviously, but not C style compilation. There's even barely any C compilers that do whole-program optimization.

Name: Anonymous 2016-08-30 16:49

>>60
Define C style compilation.

Name: Anonymous 2016-08-30 17:42

>>61
C is an abbreviation for Common Lisp. C style compilation is a compiler that compiles your program into Common Lisp or a Common Lisp dialect like Scheme or JavaScript.

Name: Anonymous 2016-08-30 18:56

>>61
(non-exclusive list of compiler-constrained issues common in C)

If you make a function call, it always compiles in a function call unless an explicitly standardized inline feature is used. (the root one of the issues of this thread's faggot)

A linker which precludes whole-program optimization

No bounding of side effects, meaning the compiler cannot make assumptions on what mutable data is truly local. Coupled with all the tons of fucking undefined behavior meaning that any human, or any high level language could perform obvious transforms that the UB constrains the C compiler from performing.

No runtime optimizations. The same compile-time bytes that were created are applied to every runtime situation. If you move the binary to another compatible but different platform, the code doesn't take advantage of tuning for the new platform and is generally compiled to """compatible""" code.

Name: Anonymous 2016-08-30 19:02

>>61
C is just portable assembler. There's too much of a one-to-one correspondence between C and the generated machine code to allow the programmer to abstract. It's also too low level to allow the compiler flexibility and freedom to make larger optimizations, meaning the programmer has to hand-optimize absolutely everything. That model is poor and makes poor programmers who can't get past the low level.

Name: Anonymous 2016-08-30 20:14

>>61
Wouldn't "runtime optimizations" only be possible with JIT compilation? The only other way I see of doing it is incorporating optimized code for every single runtime situation into the binary, but 99% of it wouldn't be used in a typical run of the program so it would basically be needless bloat.

>>64
The problem with abstractions is that you need to teach the compiler to recognize them; if the user creates code that falls just outside of the compiler's ability to recognize the abstraction being used, the resulting binary will be a mess.

Name: Anonymous 2016-08-30 20:22

Check dubs

Name: Anonymous 2016-08-30 23:02

>>65
That's the entire problem with ahead-of-time binary compilation. It's bullshit made in the 1960s, that carried downsides for no other reason than programmers are nigger luddites who can't fucking deal with change, and who can't admit the shit that they built is shit when something better comes along.

Stuff like the Mill architecture, where there's cached compilation on startup per system is leagues better.

Name: Anonymous 2016-08-30 23:06

>>65
also, anybody who uses the word "bloat" needs to be shot. Fuck you, let the machine work. Extra storage doesn't slow anything down.

Name: Anonymous 2016-08-31 0:20

>>68
cache motherfucker

Name: Anonymous 2016-08-31 0:46

>>69
You didn't read the post, you literal retard. Code that is never executed, and data that is never read, doesn't hit the cache. If you care about packing of functions into tiny cache lines, you'll be doing that manually anyway.

Name: Anonymous 2016-08-31 0:51

>>67
That's the entire problem with ahead-of-time binary compilation.
You mean that it doesn't have machine-specific optimizations? I'd think compiling once from source when moving to a new machine would be the best of both worlds - you can optimize for the machine, without the JIT overhead.

>>68
If you can afford to not be bothered by inefficient algorithms or excessive memory use, you're not using the full capabilities of the computer. Of course, that's not necessarily a bad thing - most modern personal computers are intended to have at least some ability to run 3d games on, so it's basically impossible for say a text editor to stress the system, no matter how bloated it is. And sure, in those cases it may not be worth the programmer-hours it would take to 'de-bloat' it. But if you're actually the one writing 3d games, or simulations to run on a supercomputer, then efficiency is important.

Name: Anonymous 2016-08-31 1:08

>>1
Eclipse, netbeans, visual studio (probably)

And JSLINT

Hell, many IDEs have features like these, assuming you're working in a sane language

Name: Anonymous 2016-08-31 1:15

>>71
and this is the problem with you irritating piece of shit """bloat""" spewing fuckers. You whinge on about carrying megabytes around, then somebody calls you a stupid fuckhead for whinging about the stupidest of backwards ignorant shit, and then you talk about inefficient algorithms, which ISN'T BLOAT, you utter dipshit.

If I could kill you over the internet with my bare hands, I would. Die horribly and soon, you cancer on programming and society.

Name: Anonymous 2016-08-31 1:26

>>73
Chill out bro, rage is unhealthy

Name: Anonymous 2016-08-31 1:40

inefficient algorithms, which ISN'T BLOAT, you utter dipshit.
They and bloat are in the same general category of unoptimized binaries. The ideal is to have a small binary, which executes quickly, and doesn't use more memory than necessary.

Name: Anonymous 2016-08-31 1:49

>>75
You can't equate "Oh noes the binary will have unused baggage, BLOAT! -> You're a dipshit!" with "You advocate for inneficient AlGoreIthms!"

Plus, you utter ignorant fuck, faster algorithms tend to be LARGER than smaller simpler algorithm! You think caches, heuristic analysis, threading, load balancing, and all that shit that ACTUALLY makes things faster somehow makes smaller binaries? FUCK YOU, you empty headed piece of shit. You have no knowledge or authority to try to tell anybody anything. Go fuck off back to elementary school until you've done something significant, dick.

Name: Anonymous 2016-08-31 1:50

(this space intentionally left unoptimized)

Name: Anonymous 2016-08-31 2:08

You can't equate "Oh noes the binary will have unused baggage, BLOAT! -> You're a dipshit!" with "You advocate for inneficient AlGoreIthms!"

Okay fine, I misspoke there. I was really referring to inefficient memory/CPU usage, not binary size.

Name: Anonymous 2016-08-31 3:21

>>70
i dont need to read your posts

Name: Anonymous 2016-08-31 3:36

>>79
It wasn't even my post, you dick. I wouldn't be surprised if the referenced one (>>65) was even by you, and you've achieved maximal rectal-cranial intersection by not knowing what I was referring to.

Name: Anonymous 2016-08-31 3:44

>>65 is not >>79

Name: Anonymous 2016-08-31 4:13

C is a worse portable assembler than LLVM, because at least the latter doesn't pretend to be a high level language.

Name: Anonymous 2016-08-31 4:56

>>82
"Portable assembler" as used to describe C is somewhat of a misnomer. C has the same low-level features as assembly, but uses structured syntax. Its still much lower level than most languages, however the block structure and automatic local variables are abstractions that don't exist in assembly.

Name: Anonymous 2016-08-31 17:14

>>83
Those structures don't exist in machine code, but they do exist in many assembly code environments. Just pick your ABI.

Name: Anonymous 2016-08-31 17:37

>>83,84
They exist in some machine code and some assembly. Does your school teach anything besides x86? I thought the purpose of a university was to learn things.

Name: Anonymous 2016-08-31 18:17

Does your school teach anything besides x86?
If you're making programs for personal computers, x86 is the only real option.

Name: Anonymous 2016-08-31 18:18

>>85
What makes you think I have a school?

Name: Anonymous 2016-08-31 18:24

>>80
not me

Name: Anonymous 2016-08-31 23:26

Who the fuck learns about computing in school? If that's your primary source of computational knowledge, you're stunted.

Name: Anonymous 2016-08-31 23:50

none of those features involve advanced code analysis though

Name: Anonymous 2016-09-01 7:20

>>89
I did!

Name: Anonymous 2016-09-01 16:52

>>91
You're stunted!

Name: Anonymous 2016-09-01 17:10

>>89
I also did. Just a Bachelor's of Science though, no dumb shit like graduate studies.

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