SHould I compact my code?

vincentnl

Active member
Joined
Mar 29, 2003
Messages
40
Location
Netherlands
Hi,

I am wondering, whether I should compact my code more in general.

Will the first block run faster than the second? or will the compiler create speedequivalent code?

codeblock 1
int i = 3
int j = 6
point d = new point(i,j)
SomeMethod(d)

Or should I sacrifice some readability and compact this to

codeblock2

SomeMethod( new Point(3,6)
 
Readability,

although it does not really show from the chosen examples.

Compilers must be smart enough to see that these local variables are only used once !
 
Oh yeah of course, these local vars are destroyed soon after they go out of scope.

I dont care much for readability... we use overloaded methods that have 5 or so args then readability is already lost.
 
I personally find the second way more readable anyway in one line I can see that a method is being called with a point of x = 3 and y = 6.
 
Back
Top