Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsDiscussion Forum → Recommendations for free Java compilers?
12
Recommendations for free Java compilers?
2007-07-17, 6:03 PM #41
The problem with Freelancer and the Notepad people is that they have failed to provide reasons why color highlighting is BAD. For example, why does color cause clutter?

It can't hurt...

Honestly, maybe full-fledged color coding isn't necessary, but I at least like to have strings and comments in different colors.

Notepad's weaknesses have nothing to do with color coding though, as StrikeAthius pointed out. Quickly being able to see where parenthetical expressions begin and end is a nice feature on Crimson Editor. I would recommend Crimson Editor. You can *turn off* the color feature if you must, but I could hardly live without it once I got used to it during my programming days.
2007-07-17, 6:03 PM #42
cool matty no offense but maybe you just dont see enough code bro


would you find it helpful while reading a book if every vowel was yellow, every consonant was blue, and every punctuation mark was green?


my point is: if you actually code a decent amount then you dont need some piece of software to fisher-price up the code for you just to be able to read it.


edit: im not saying syntax coloration is useless; im saying i think some of you are cracking it up to be a necessity :P
[ B A H ]
Bad *** by nature,
Hackers by choice
2007-07-17, 6:13 PM #43
Originally posted by Emon:
Unless maybe your brain is broken.


probably more right than you know :)




color coding plz save me!


Code:
int SynchsafeToInt(unsigned char *pSynchsafe)
{
	unsigned long ss = pSynchsafe[3]|(pSynchsafe[2]>>8)|(pSynchsafe[1]>>16)|(pSynchsafe[0]>>24);
	for(int x=31,l=0,i=0;x>=0;x--)
	{ i+=(1<<l)*((ss&(0x80000000>>x))!=0);
	  l+=(x%8)!=0; }
	return i;
}


Code:
inline unsigned long HashInsensitive(const char *szString)
{
	unsigned long hashId = 0;

	if(szString == 0)
		return 0;

	for(int c,q=0, tmp; c=(int)szString[q]; q++)
	{
		if((c>='A')&&(c<='Z'))
			c+='a'-'A';

		hashId = (hashId << 4) + c;
		if( (tmp = hashId & 0xF0000000) != 0 )
		{
			hashId ^= (tmp >> 24);
			hashId &= ~tmp;
		}
	}

	return (hashId&0x7FFFFFFF);
}


Code:
. . . .
// compute collision impulse
float imp = vnd / ((pObjectA->getInverseMass() + pObjectB->getInverseMass()) + ((relativeContactPtA^normal)*(relativeContactPtA^normal)*pObjectA->getInverseInertia()) + ((relativeContactPtB^normal)*(relativeContactPtB^normal)*pObjectB->getInverseInertia()));
CVector2 impulse = ( normal * (-1.0f * (1.0f + fRestitution) * imp) ) + ( vec * (fDynamicFriction * imp) );
. . . .


Code:
bool CExpressionBuilder::formExpressionsAtDepth(int nDepth)
{
	std::list<BUILDERNODE>::iterator iter, iterLeft, iterRight;
	BUILDERNODE *curNode;
	LEXTOKEN *curToken;
	IExpression *expression, *pLeft, *pRight;
	int curPrecedence;
	int nOperatorID;

	IREPORT(formExpressionsAtDepth);

	// traverse the list, looking for immediate tokens (values/identifiers) at specified depth.
	// if the token is a value or identifier, wrap it into Value or Identifier expression
	for(iter = m_buildnodes.begin(); iter != m_buildnodes.end(); iter++)
	{
		curNode=&(*iter);

		// ignore processing preexisting expressions, and verify depth
		if( (curNode->depth == nDepth) && (!curNode->isExpression) )
		{
			curToken = curNode->pToken;

			// check for identifiers
			if( (curToken->type == TOKEN_IDENTIFIER) || (curToken->type == TOKEN_LOCALIDENTIFIER) )
				expression = formExpression_identifier(curToken);
			else
				// check for values
				if( (curToken->type == TOKEN_VALUE_INT)		||
					(curToken->type == TOKEN_VALUE_FLOAT)	||
					(curToken->type == TOKEN_VALUE_VECTOR)	|| 
					(curToken->type == TOKEN_VALUE_STRING) )
					expression = formExpression_value(curToken);
				else
					// dont do anything to tokens that are not values or identifiers
					continue;

			// make sure we could form the immediate expression
			if(expression == 0)
			{
				report(RL_ERROR, "Could not wrap value/identifier token");

				IFAIL();
				return false;
			}

			// set the expression's owner
			expression->m_pScript = m_pParser->m_pTargetScript;

			// replace the immediate with the wrapper expression
			curNode->pExpression = expression;
			curNode->isExpression = true;
		}
	}

	// we want to combine expressions using operator precedence, so traverse the list once for
	// each operator precedence level, starting with the highest. we skip processing precedence 0
	// because no operators assume this value. (technically i think an expression has a precedence of 0)
	for(curPrecedence=OPERATOR_MAX_PRECEDENCE; curPrecedence > 0; curPrecedence--)
	{
		// now traverse the list again, looking for operators of current precedence that have expressions associated with them
		// on the proper depth, wrapping those operations into Binary, Prefix, and Postfix expressions
		for(iter = m_buildnodes.begin(); iter != m_buildnodes.end(); iter++)
		{
			curNode=&(*iter);

			// we want to examine operators of current depth (note this excludes parens and subscripts, which have depths of -1, because they are non-functional operators)
			if( (curNode->depth == nDepth) && (!curNode->isExpression) && (curNode->pToken->type == TOKEN_OPERATOR) )
			{
				// curToken should contain an int; an enum of OPERATORS, not past NUM_OPERATORS
				curToken = curNode->pToken;
				nOperatorID = curToken->token.getInt();

				// lets verify that the operator is a functional one
				if( (nOperatorID < 0) || (nOperatorID >= NUM_OPERATORS) )
				{
					report(RL_WARNING, "Rejected attempt to combine expressions with non-functional operator (opID: %d)", nOperatorID);

					// skip
					continue;
				}

				// make sure operator is of current precedence (using operator id as index into lookup table)
				if(CExpressionBuilder::s_pOperatorPrecedences[nOperatorID] != curPrecedence)
					// skip if not
					continue;

				// aquire a left-side operand of equal or higher depth based on current position
				if(aquireOperand(iter, nDepth, -1, iterLeft))
					// aquire left side expression
					pLeft = (*iterLeft).pExpression;
				else
					// no left side
					pLeft = 0;

				// aquire a right-side operand of equal or higher depth based on current position
				if(aquireOperand(iter, nDepth, 1, iterRight))
					// aquire right side expression
					pRight = (*iterRight).pExpression;
				else
					// no right side
					pRight = 0;

				// form the expression
				expression = combineExpressions(nOperatorID, pLeft, pRight);

				// if we successfully combined the expressions, we should delete the nodes involved
				if(expression != 0)
				{
					// set the expression's owner
					expression->m_pScript = m_pParser->m_pTargetScript;

					// recycle the operator's node to contain the resulting expression.
					curNode->pExpression = expression;
					curNode->isExpression = true;

					// if a left side was used, erase it
					if(pLeft != 0)
						m_buildnodes.erase(iterLeft);

					// if a right side was used, erase it
                    if(pRight != 0)
						m_buildnodes.erase(iterRight);
				} else
					report(RL_WARNING, "Unable to combine expressions");
			}
		}
	}

	// success
	return true;
}
[ B A H ]
Bad *** by nature,
Hackers by choice
2007-07-17, 6:46 PM #44
and another notable mention: the cog-based 3d rasterizer i was working on featuring gouraud shading, written exclusively in notepad with no parse errors


[http://binarydemons.com/~strike/files/jktriangle.jpg]

Code:
# jkras.cog     DCP 07
#
#
#  NOTE:  [in*] indicates that the parameter may be modified although it is not used
#         to return any meaningful value.
#
#
#  MATRIX:  4x4 matrix stored in 5 heap entries
#
#           0x 0y 0z 4x
#           1x 1y 1z 4y
#           2x 2y 2z 4z
#           3x 3y 3z  1
#
#
# HEAP:  The beginning of the heap contains the block definition. Each entry contains
#        2 values:  pointer to start of block, and size of block (in elements)
#
#        after the block definition is a temp pointers list of size hpmaxblocks
#
#        
#
################################################################################################

symbols

#  PROPERTIES PROVIDED BY USER
#-----------------------------------------------------------------------------------------------
# screen attributes
int		cellsWidth				# [const]	screen width
int		cellsHeight				# [const]	screen height
surface 	firstCell				# [const]	surface of pixel 0,0

# system attributes
cog		remoteheap				# [const]	an instantiation of rmtheap.cog



#  API CALLS
#-----------------------------------------------------------------------------------------------
# drawSolidTriangle
#
#   [parameters]
vector		tv0			local		# [in*]		triangle vertex 0
vector		tv1			local		# [in*]		triangle vertex 1
vector		tv2			local		# [in*]		triangle vertex 2
flex		tc0			local		# [in*]		triangle vertex color 0
flex		tc1			local		# [in*]		triangle vertex color 1
flex		tc2			local		# [in*]		triangle vertex color 2



#  INTERNAL METHODS
#-----------------------------------------------------------------------------------------------
# sortSolidTriangleVerts
#
#   uses drawXXXTriangle params (in/out)


# solidScanConvert
#
#   [parameters]
vector		cv0			local		# [in]		endpoint 0
vector		cv1			local		# [in]		endpoint 1
flex		cc0			local		# [in]		endpoint color 0
flex		cc1			local		# [in]		endpoint color 1
int		pedge			local		# [in/out]	edge pointer
int		pz			local		# [in/out]	depth value pointer
int		pcolor			local		# [in/out]	color pointer
int		edgeheight		local		# [out]		edge height


# drawSolidScanline
#
#   [parameters]
flex		sy			local		# [in]		pixel row
flex		sx0			local		# [in/out]	current pixel column
flex		sz0			local		# [in/out]	current pixel depth
flex		sc0			local		# [in/out]	current pixel color
flex		sx1			local		# [in]		ending pixel column
flex		sz1			local		# [in]		ending pixel depth
flex		sc1			local		# [in]		ending pixel color



#  HEAP METHODS
#-----------------------------------------------------------------------------------------------
# new
#
#  [parameters]
int		size			local		# [in]		requested element count
int		ptr			local		# [out]		pointer to allocated block


# delete
#
#  [parameters]
#int		ptr			local		# [in]		pointer to allocated block



# attributes
int		hpmaxblocks=0		local
int		hpnumblocks=0		local
int		hpdatsize=0		local

# temps
int		hpx			local



#  ENGINE HOOKS
#-----------------------------------------------------------------------------------------------
message		startup
message		pulse


end
code
################################################################################################

startup:
	SetPulse(0.01);


	totalheapsize = 0;


	// used for scan conversion
	reqheapsize = cellsHeight * 6;
	if(reqheapsize > totalheapsize) totalheapsize = reqheapsize;


	HeapNew(totalheapsize);

	jkStringClear();
	jkStringConcatASCIIString("Heap size: ");
	jkStringConcatInt(totalheapsize);
	jkStringOutput();

	blah = 0.0;

	return;

#-----------------------------------------------------------------------------------------------

pulse:
	// clear backbuffer
	for(x=cellsWidth*cellsHeight+firstCell-1; x>=0; x=x-1)
		ClearFaceType(x, 0xFF00);

	blah = blah + 0.05;
	if(blah >= 1.0)
		blah = 0.0;


	tv0 = VectorSet(40.0, 0.0, 0.0);	tc0 = 0;
	tv1 = VectorSet(0.0, 120.0, 0.0);	tc1 = 0;
	tv2 = VectorSet(100.0, 40.0, 0.0);	tc2 = blah;
	call drawSolidTriangle;


	// present backbuffer
	for(x=cellsWidth*cellsHeight+firstCell-1; x>=0; x=x-1)
		SetSurfaceLight(x, ((GetFaceType(x)/256)&0xFF)/255, 0);

	return;

#-----------------------------------------------------------------------------------------------

drawSolidTriangle:
	// clamp colors
	if(tc0 < 0.0) tc0 = 0.0;
	else if(tc0 > 1.0) tc0 = 1.0;
	if(tc1 < 0.0) tc1 = 0.0;
	else if(tc1 > 1.0) tc1 = 1.0;
	if(tc2 < 0.0) tc2 = 0.0;
	else if(tc2 > 1.0) tc2 = 1.0;

	call sortSolidTriangleVerts;


	edge0 = 0; edge1 = edge0+cellsHeight;
	z0 = edge1+cellsHeight; z1 = z0+cellsHeight;
	color0 = z1+cellsHeight; color1=color0+cellsHeight;

	// determine horizontal orientation
	if(VectorX(tv2) <= VectorX(tv1))
	{
		edgeL = edge0; edgeR = edge1;
		zL = z0; zR = z1;
		colorL = color0; colorR = color1;
	} else {
		edgeL = edge1; edgeR = edge0;
		zL = z1; zR = z0;
		colorL = color1; colorR = color0;
	}

	cv0 = tv0; cc0 = tc0;
	cv1 = tv1; cc1 = tc1;
	pedge = edge1; pz = z1; pcolor = color1;
	call solidScanConvert;

	cv0 = tv1; cc0 = tc1;
	cv1 = tv2; cc1 = tc2;
	pedge = edge1+edgeheight; pz = z1+edgeheight; pcolor = color1+edgeheight;
	call solidScanConvert;

	cv0 = tv0; cc0 = tc0;
	cv1 = tv2; cc1 = tc2;
	pedge = edge0; pz = z0; pcolor = color0;
	call solidScanConvert;

	// rasterize scanlines
	offptr = 0;
	for(sy = VectorY(tv0); edgeheight > 0; sy=sy-1.0)
	{
		sx0 = HeapGet(edgeL+offptr); sx1 = HeapGet(edgeR+offptr);
		sz0 = HeapGet(zL+offptr); sz1 = HeapGet(zR+offptr);
		sc0 = HeapGet(colorL+offptr); sc1 = HeapGet(colorR+offptr);
		call drawSolidScanline;
		offptr = offptr + 1;
		edgeheight = edgeheight - 1;
	}

	printflex(tc1);

	return;

#-----------------------------------------------------------------------------------------------

sortSolidTriangleVerts:
	y0g1 = VectorY(tv0) > VectorY(tv1);
	y0g2 = VectorY(tv0) > VectorY(tv2);
	y1g2 = VectorY(tv1) > VectorY(tv2);

	if(y0g1 && y0g2)
	{
		if(!y1g2)
		{
			tempv = tv1; tempc = tc1;
			tv1 = tv2; tc1 = tc2;
			tv2 = tempv; tc2 = tempc;
		}
	} else if( (!y0g1) && y1g2 )
	{
		tempv = tv0; tempc = tc0;
		tv0 = tv1; tc0 = tc1;
		if(y0g2)
		{
			tv1 = tempv; tc1 = tempc;
		} else {
			tv1 = tv2; tc1 = tc2;
			tv2 = tempv; tc2 = tempc;
		}
	} else {
		tempv = tv0; tempc = tc0;
		tv0 = tv2; tc0 = tc2;
		if(y0g1)
		{
			tv2 = tv1; tc2 = tc1;
			tv1 = tempv; tc1 = tempc;
		} else {
			tv2 = tempv; tc2 = tempc;
		}
	}

	return;

#-----------------------------------------------------------------------------------------------

solidScanConvert:
	edgeheight = (VectorY(cv0)-VectorY(cv1) + 0.999) & 0xFFFF;
	if(edgeheight < 1)
		return;

	y = edgeheight;

	// calculate interpolation slopes
	dedge = ( VectorX(cv1)-VectorX(cv0) ) / edgeheight;
	dz = ( VectorZ(cv1)-VectorZ(cv0) ) / edgeheight;
	dcolor = ( cc1 - cc0 ) / edgeheight;

	// initialize values
	curedge = VectorX(cv0);
	curz = VectorZ(cv0);
	curcolor = cc0;

	while(y > 0)
	{
		// store interpolated edge values
		HeapSet(pedge, curedge); pedge=pedge+1;
		HeapSet(pz, curz); pz=pz+1;
		HeapSet(pcolor, curcolor); pcolor=pcolor+1;

		// continue iteration and interpolate
		y=y-1;
		curedge=curedge+dedge;
		curz=curz+dz;
		curcolor=curcolor+dcolor;
	}

	return;

#-----------------------------------------------------------------------------------------------

drawSolidScanline:
	//if(sx1 < sx0)
	//	return;

	zX = (sz1-sz0) / (sx1-sx0);
	cX = (sc1-sc1) / (sx1-sx0);

	while(sx0<=sx1)
	{
		call drawSolidFragment;
		sx0 = sx0 + 1.0;
		sz0 = sz0 + zX;
		sc0 = sc0 + cX;
	}

	return;

#-----------------------------------------------------------------------------------------------

drawSolidFragment:
	sf = (sx0+sy*cellsWidth)&0xFFFFFF;

	// handle depth/stencil check and update here


	// set the pixel
	ClearFaceType(sf, 0xFF00);
	SetFaceType(sf, ((sc0*255)*256)&0xFF00);

	return;

#-----------------------------------------------------------------------------------------------

new:
	// try to find a free block that's big enough
	call dumbnew;
	if(ptr != -1)
		return;

	// heap is consumed; need to allocate more blocks


	// dump heap to remote, if applicable
	hptemp = hpmaxblocks*2+hpdatsize;
	if(hptemp>0)
	{
		SendMessage(remoteheap, user0, 1, hptemp, -1, -1);
		for(hpx=0; hpx<hptemp, hpx=hpx+4)
			SendMessage(remoteheap, user0, heapget(hpx), heapget(hpx+1), heapget(hpx+2), heapget(hpx+3));
	}

	// grow heap
	hpdatsize = hpdatsize+size;
	hpmaxblocks = hpmaxblocks+1;
	heapnew(hpmaxblocks*2+hpdatsize);

	// restore previous blocks, if applicable
	if(hptemp>0)
	{

	}

	// establish new pointer
	ptr = hpdatsize-size-1;

	// write new block
	hpx = (hpmaxblocks-1)*2;
	heapset(hpx, ptr);
	heapset(hpx+1, size*-1);    // flag as used
	return;

dumbnew:
	for(hpx=0; hpx<hpmaxblocks; hpx=hpx+1)
		if(heapget(hpx*2+1)>=size)
		{
			
			ptr=heapget(hpx*2);
			heapset(hpx*2+1, heapget(hpx*2+1)*-1);	 // flag as used
			return;	
		}
	ptr=-1;
	return;

#-----------------------------------------------------------------------------------------------

delete:

	return;

################################################################################################

end
[ B A H ]
Bad *** by nature,
Hackers by choice
2007-07-17, 7:07 PM #45
Want a cookie? I've written a compiler front-end with no syntax highlighting and very minimal debugging features that worked perfectly... Doesn't mean I think it's better than a nice IDE with good highlighting. This argument is silly.
2007-07-17, 7:08 PM #46
Originally posted by Darth:
Want a cookie? I've written a compiler front-end with no syntax highlighting and very minimal debugging features that worked perfectly... Doesn't mean I think it's better than a nice IDE with good highlighting. This argument is silly.


and i wrote the actual compiler. whats your point?
[ B A H ]
Bad *** by nature,
Hackers by choice
2007-07-17, 7:33 PM #47
Indented, commented code is for n00bs. :downswords:
2007-07-17, 7:56 PM #48
Originally posted by West Wind:
CM, have you ever heard of the 80x40 rule? One of the veteran programmers I knew a while ago taught it to me. Basically it states that every function/method you write should fit, in its entirety, on a Text Mode Terminal (80 Columns by 40 Lines ballpark). If you have a function that doesn’t fit, refractor until it does.

Yes and as we all know the majority of industry professionals program in 80x40 terminal windows. :downswords:
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2007-07-17, 8:05 PM #49
It's not a matter of being able to read or write code. It's about how quickly/efficiently one reads or writes code. To borrow your reading example, I don't color code verbs/nouns/prepositions when I read poetry, but I do box, highlight, underline key words to help aid my interpretation. That way, I can spend less time *reading* and more time *interpreting*. If you ask me, it's worth it even though I can do it without annotation.

Obviously you don't do much reading. ;)
2007-07-17, 9:12 PM #50
Originally posted by West Wind:
CM, have you ever heard of the 80x40 rule? One of the veteran programmers I knew a while ago taught it to me. Basically it states that every function/method you write should fit, in its entirety, on a Text Mode Terminal (80 Columns by 40 Lines ballpark). If you have a function that doesn’t fit, refractor until it does.

It’s a hard rule to live by, but it really does force you to write better, cleaner, and leaner code. There are some exceptions (like writing interface code), but I try to keep to it as often as possible.


Np, and even if I did I wouldn't write it like that. That would piss me off completely. It would require me to break up lines and SQL statements in strange and stupid ways all for the sake of meeting some virtual cutoff line, that in the end, NO ONE will ever need.

It sounds like it was some BS rule made up a long time ago when everyone used to do their editing in vi or whatever to stop vertical scrolling. (I should add that Wikipedia and Google never heard of this rule either)

Quote:
As for Syntax Highlighting, it can be exceptionally useful. not in writing code, but as has been pointed out in quickly recognizing where you are in your code, and giving your visual landmarks to help navigate by. Try becoming intimately familiar with 10,000 lines of code… Syntax Highlighting is just another tool to help you learn where you are and what your doing. Of course it’s not essential, but then again, you could always just echo you terminal into a file directly… If you wanted.
This is exactly the point. They're trying to say it somehow makes it more complicated to read... when at the least it doesn't do anything, and at the most it becomes incredibly helpful. :/

Originally posted by StrikeAthius:
cool matty no offense but maybe you just dont see enough code bro

would you find it helpful while reading a book if every vowel was yellow, every consonant was blue, and every punctuation mark was green?

my point is: if you actually code a decent amount then you dont need some piece of software to fisher-price up the code for you just to be able to read it.

edit: im not saying syntax coloration is useless; im saying i think some of you are cracking it up to be a necessity :P


No, I'm saying it's silly to think that it HINDERS your ability to code. It doesn't "fisher price" up your code, it makes it easier to find what the hell you're looking for, that's all. Many times I've gone scrolling through something looking for a specific function, when I knew almost exactly what I was looking for. Turn on syntax highlighting, and it's like someone threw a spotlight on the thing.

Originally posted by Mystic0:
'color coding' undermines the unit character byte and cannot be parsed by regular expressions, and it emphasizes course grain units depicted by colors, regardless of any sub-units a single color may encompass. And it's plain ugly, annoying, and bearing no self description of color semantics it destroys portability. Rob pike doesn't like it, so neither do i. Text is god, and he is jesus


What ARE you talking about? Because it sure as hell isn't anything about syntax highlighting. :confused:
2007-07-17, 9:14 PM #51
Originally posted by Cool Matty:
Np, and even if I did I wouldn't write it like that. That would piss me off completely. It would require me to break up lines and SQL statements in strange and stupid ways all for the sake of meeting some virtual cutoff line, that in the end, NO ONE will ever need.


It's actually nice to break up SQL statements. "Select..." on one line, "From..." on another, etc. But I suppose that is just personal preference.

P.S. I agree about the rule being slightly bogus, especially if it counts blank space. Some of my lines exceed 80 columns because I liberally tab them not because there's a lot of excess code. This is especially because I insist on breaking my SQL queries into multiple lines and tabbing each line.
2007-07-17, 9:22 PM #52
Originally posted by Cool Matty:
Np, and even if I did I wouldn't write it like that. That would piss me off completely. It would require me to break up lines and SQL statements in strange and stupid ways all for the sake of meeting some virtual cutoff line, that in the end, NO ONE will ever need.


It's not really about improving readability (though it can drastically help). It kinda ties into Unit-Testing (something I’m sure you all practice religiously ;) ). The idea is that every complex program can be broken down into discrete units, and that each unit should function independent of the internal state of any other unit. The 80x40 rule is a rule of thumb to gage how complex to make your units, and to identify places in your code that require special attention.

40 lines of Code is quite a bit, think about it? Aside from initialization tasks, what functional unit demands more than 40 lines of code? And anything that does require more than 40 lines of code (ESPECIALLY initialization) deserves special attention and commenting.

As for the 80 columns, if you have a single line more than 80 columns long, odds are you either have a very complex syntactic structure, deeply nested control structures, or multiple inline expressions. In all three cases, if it really is necessary to go over 80 columns, it probably deserves special attentions and/or commenting anyway.

I’m not saying that everything must absolutely conform to 80x40, it’s just a programming paradigm. But I did learn it from a CMM level 4 shop, and it honestly seems to make a difference when I use it in the real world.

[Edit] Personally, I don't count Comments towards the 40 line limit. As for whitespace, I count indentation (deep nesting), but I don't count spaces used to break up chunks of code. It's just a guide, and I can assure I break it quite regularly, but it's a way of thinking that seems to help, and I’m kinda disappointed that I seem to be the only one whose heard of it, or that it makes sence too.
"Well, if I am not drunk, I am mad, but I trust I can behave like a gentleman in either
condition."... G. K. Chesterton

“questions are a burden to others; answers a prison for oneself”
2007-07-17, 9:41 PM #53
I like syntax highlighting because it changes the color of comments so you can sort them out at a glance. Visual Studio also changes the color of code if it is not compiled, so you can quickly visualize preprocessor conditions.

All syntax highlighting does is give you a quick overview of the code. That's always a good thing unless you have way too much free time.


I don't know where anybody gets the twisted idea that a "program unit" should fit into a VT-****ing-100 but that is probably the dumbest thing I've ever heard. It's that kind of attitude that makes perl programmers worthless and it sure has hell doesn't belong in a language as prone to critical failure as C. There are a lot of tasks that cannot be done in 40 lines of code, and while many of them can be broken up into smaller units it is absurd to do so for, among other reasons, performance considerations. Even inlining a function carries a performance penalty. If you call a complex procedure often, you could be looking at a significant hit.

Visual Studio's #regions are a much more elegant solution to this particular manufactured problem.
2007-07-17, 10:02 PM #54
Like it or not, 80 columns IS STILL the standard (but for how long is anyone’s guess). Look at style guides for virtually every language out there, (C, FORTRAN, C++, Perl, Pascal, Python, Java…). In fact, the only language whose style guide does not seem too explicitly list 80 (or 78) columns is your precious C#. I’m not saying that 80 columns is a holy writ from above, and there is good reason to think that modern languages will start getting away from it, like C# seems to be, but I’m arguing that there is still good reason for the 80 Column Rule, especially with older languages. Not to mention the fact that the allot of serious coding outfits and open source projects will expect you to comply with 80 column rule.

In all honestly, the 40 line rule is the oddball one, as it is never referenced in any of the style guides, but also seems to make the most difference.
"Well, if I am not drunk, I am mad, but I trust I can behave like a gentleman in either
condition."... G. K. Chesterton

“questions are a burden to others; answers a prison for oneself”
2007-07-17, 10:13 PM #55
I write all of my code to fit 80 lines because that's visual studio with two side-by-side code panes.
2007-07-17, 10:20 PM #56
teletype SUCKS

i, for one, use the recently introduced raster image displays

USER WAS BANNED FOR THIS POST
2007-07-17, 11:06 PM #57
ATTN: Writing code w/o syntax highlighting doesn't make you more of a "hardcore programmer."

NOTICE: Writing software out of a terminal window isn't good practice. In fact, it's ****ing stupid. It does not make you a hardcore programmer of any kind.

JL: Queries like that should be done in stored procedures anyway. This is much better handled in a stored proc then all in some string.
Code:
Stored proc:
select
	a.this, b.this, a.that
from
	tblA a, tblB b
where
	b.here in (
		select a.pkLOL from tblA a where a.fkDongs = 'big'
	)
Code to the left of him, code to the right of him, code in front of him compil'd and thundered. Programm'd at with shot and $SHELL. Boldly he typed and well. Into the jaws of C. Into the mouth of PERL. Debug'd the 0x258.
2007-07-18, 2:44 AM #58
Originally posted by Jon`C:
I like syntax highlighting because it changes the color of comments so you can sort them out at a glance. Visual Studio also changes the color of code if it is not compiled, so you can quickly visualize preprocessor conditions.


i agree emphatically; this is the one colorizing feature i would be pissed to lose!

for the record though, it still has nothing to do with the detected types of specific tokens :D



Originally posted by Jon`C:
Visual Studio's #regions are a much more elegant solution to this particular manufactured problem.


agreed! but they dont always work properly .(



good sober response jon (unlike mine, which literally wasnt sober). me likes you :downs:



i agree with the idea of the 80x40 rule. i think specifically saying 80x40 is a bit archaic though.

put more practically:
-if a function is really long, split it up to multiple functions
-if a line is really wide, split it up to multiple lines
[ B A H ]
Bad *** by nature,
Hackers by choice
2007-07-18, 3:10 AM #59
woot! thanks to this thread i found the source of a nasty bug in jkras.cog that had me scratching my head for a while.

i was spending my time trying to figure out why 1 vertex color always seemed to be ignored.. turns out it was a scanline problem :argh:

Code:
cX = (sc1-sc1) / (sx1-sx0);



NOW it has gouraud shading :)
[http://binarydemons.com/~strike/files/jktri3.JPG]
[ B A H ]
Bad *** by nature,
Hackers by choice
12

↑ Up to the top!