English 中文(简体)
What is the reasoning behind the Makefile whitespace syntax?
原标题:

I m revisiting Python after Michael Sparks s excellent walk through of Peter Norvig s Python spell checker at the SO DevDay in London.

One of the points he highlighted was how clean Python is to look at. Not cluttered with braces for scopes but using white space to indicate block scope instead.

This got me thinking. I wonder if that is the reason behind the TAB indentations that are prepended to the commands needed to build a make target.

Was it the same clarity aspect? To readily distinguish between a target and the commands needed to build the target?

最佳回答

From "The Art of Unix Programming" comes this quote:

Why the tab in column 1? Yacc was new, Lex was brand new. I hadn t tried either, so I figured this would be a good excuse to learn. After getting myself snarled up with my first stab at Lex, I just did something simple with the pattern newline-tab. It worked, it stayed. And then a few weeks later I had a user population of about a dozen, most of them friends, and I didn t want to screw up my embedded base. The rest, sadly, is history.
-- Stuart Feldman
问题回答

I think Makefiles make the mistake of insisting on precisely one tab character for indentation. What s the harm in allowing spaces? There s no loss of precision, since shell commands can t usefully begin with spaces anyway, and there s no confusion between target lines and command lines.





相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

pdo database abstraction

Can someone help me to see what is going wrong with this setup I build the @sql query in the function below like this. The extra quotes are setup in the conditions array. $sql .= " WHERE $...

I wish I could correlate an "inline view"

I have a Patient table: PatientId Admitted --------- --------------- 1 d/m/yy hh:mm:ss 2 d/m/yy hh:mm:ss 3 d/m/yy hh:mm:ss I have a PatientMeasurement table (0 to ...

Syntax help! Php and MYSQL

Original: $sql = "SELECT DATE(TimeAdded) AS Date, $column_name FROM Codes ORDER BY TimeAdded ASC"; Altered: $sql = "SELECT DATE("m", TimeAdded ) AS Date, ColumnName FROM TableName ORDER BY ...

Is this code Equivalent

I am not a fan of the following construction if (self = [super init]) { //do something with self assuming it has been created } Is the following equivalent? self = [super init]; if (self != ...

热门标签