YouPreferSomethingLikeThis or you-prefer-something-like-this?
-
Can we add a pistol-whipping for unnecessary use of
GOTO
?Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
OriginalGriff wrote:
Can we add a pistol-whipping for unnecessary use of
GOTO
?ftfy
Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
-
OriginalGriff wrote:
Can we add a pistol-whipping for unnecessary use of
GOTO
?ftfy
Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
:-D Sometimes a GOTO is the best way out - it can be a cleaner solution than a bool and test, test, test, test to get out of multiple loops. I haven't used one since I started with C#, and probably haven't used one (outside assembler code where you don't get a choice) for twenty years though.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
-
Vivic wrote:
COBOL is better.
That is the first time I have ever seen those three words together, in that order, without them having the suffix "than being nailed to a wall by your eyes and having your genitals stapled together." And hopefully the last! :laugh:
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
OriginalGriff wrote:
"than being nailed to a wall by your eyes and having your genitals stapled together."
Hey, don't knock it. There are people out there that would pay good money for that kind of experience! (APL devs for example!) ;)
-
:-D FORTRAN had a line length limit of 80 characters (after that you needed to put a Continuation character in column 7 of the next line), so lots of things got shortened as much as possible. Produced some gawd-awful code by modern standards, but good enough to get men onto the moon! And a heck of a lot better than COBOL, which had no such variable name limit.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
That would be Fortran 66 or earlier most F77 compilers allowed longer lines as an extension F90 onwards its in the language spec. Also even in Fortran IV the length of the variable could exceed 6 chars but anything beyond that was ignored by the parser and they could include lowercase. Up to Fortran IV there was no need to worry about lowercase as data entry was by teletype if you were lucky or card or tape punch.
-
That would be Fortran 66 or earlier most F77 compilers allowed longer lines as an extension F90 onwards its in the language spec. Also even in Fortran IV the length of the variable could exceed 6 chars but anything beyond that was ignored by the parser and they could include lowercase. Up to Fortran IV there was no need to worry about lowercase as data entry was by teletype if you were lucky or card or tape punch.
Guess which version I learnt? :laugh:
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
-
Before I step into the world of linux, I always use camel case, but in the linux world, almost everything are separated by a dash Now I have to manage a cross platform project and is thinking about which naming convention to adopt
I almost always use a single word (RunLogin()). Sometimes I will use '_'. For example, api_GetValue().
-
Before I step into the world of linux, I always use camel case, but in the linux world, almost everything are separated by a dash Now I have to manage a cross platform project and is thinking about which naming convention to adopt
camelCase/PascalCase seems to be becoming more popular in the open source world, and I would stick with that. There are some problems with other styles. Dashes can't be used in any language that uses them as subtraction operators, which is most of them. About the only place you can use dashes is in CSS, which isn't really a language and so does not have operators. You didn't mention underscores, another old style. Underscores sometimes tend to get lost visually in some formatting, and many people think that they separate words in a variable so that it is harder to scan code quickly, since the words may look like separate variables. Underscores also make variable names longer. So that leaves camelCase/PascalCase. Use lower case for the first character of variables and method names, and upper case for class names. This is especially used in PHP, and can also be used in any other language. (Microsoft uses mostly upper case for the first letter, with some complicated rules for variations, which I don't like.)
-
:-D Sometimes a GOTO is the best way out - it can be a cleaner solution than a bool and test, test, test, test to get out of multiple loops. I haven't used one since I started with C#, and probably haven't used one (outside assembler code where you don't get a choice) for twenty years though.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
Hi OriginalGriff, The thought occurs to me (note the disclaimer of responsibility inherent in the phrasing there) that it would be most interesting to see an analysis (Tip/Trick ?) of what IL is produced by, for example, the C# compiler, in a complex series of nested loops with possible multiple exit-all-loop-pathways, as you eloquently described: "a bool and test, test, test, test to get out of multiple loops." Easy to imagine the 'Goto just gets IL'd into a 'jump' statement, as 'switch/case statements' condition-match code is, under certain conditions (for example, where the case conditions are a series of incrementing-by-one ints). Being quite ignorant of issues in multi-thread programming, I'd be curious to know if there are any gotchas in using 'Goto in such conditions. Of course, for many "No 'Goto'" will remain a sacred commandment revealed to us, yea, verily, even as a source of "mental illness," by Saint Djikstra.[^]. best, Bill
"The greatest mystery is not that we have been flung at random between the profusion of matter and of the stars, but that within this prison we can draw from ourselves images powerful enough to deny our nothingness." Andre Malraux
-
Hi OriginalGriff, The thought occurs to me (note the disclaimer of responsibility inherent in the phrasing there) that it would be most interesting to see an analysis (Tip/Trick ?) of what IL is produced by, for example, the C# compiler, in a complex series of nested loops with possible multiple exit-all-loop-pathways, as you eloquently described: "a bool and test, test, test, test to get out of multiple loops." Easy to imagine the 'Goto just gets IL'd into a 'jump' statement, as 'switch/case statements' condition-match code is, under certain conditions (for example, where the case conditions are a series of incrementing-by-one ints). Being quite ignorant of issues in multi-thread programming, I'd be curious to know if there are any gotchas in using 'Goto in such conditions. Of course, for many "No 'Goto'" will remain a sacred commandment revealed to us, yea, verily, even as a source of "mental illness," by Saint Djikstra.[^]. best, Bill
"The greatest mystery is not that we have been flung at random between the profusion of matter and of the stars, but that within this prison we can draw from ourselves images powerful enough to deny our nothingness." Andre Malraux
Hi Bill! It would indeed - I suspect that it will be a lot more complex than just a jump, particularly if there are try-catch or try finally blocks involved. It sounds more work than I want at the moment though. Particularly as I have no wish to be tarred and feathered by the Pascal Stasi for deliberately using a GOTO and publishing the results! :laugh:
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
-
That would be Fortran 66 or earlier most F77 compilers allowed longer lines as an extension F90 onwards its in the language spec. Also even in Fortran IV the length of the variable could exceed 6 chars but anything beyond that was ignored by the parser and they could include lowercase. Up to Fortran IV there was no need to worry about lowercase as data entry was by teletype if you were lucky or card or tape punch.
And if your teletype was an IBM golfball typewriter you could write a program called Noddy that made the golfball nod its head nid-nod. We even had a ping-pong game which made the golfball go across the palten writing ping and coming back writing pong. :)
-
:-D FORTRAN had a line length limit of 80 characters (after that you needed to put a Continuation character in column 7 of the next line), so lots of things got shortened as much as possible. Produced some gawd-awful code by modern standards, but good enough to get men onto the moon! And a heck of a lot better than COBOL, which had no such variable name limit.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
OriginalGriff wrote:
FORTRAN had a line length limit of 80 characters (after that you needed to put a Continuation character in column 7 of the next line),
Close, but the continuation character was in column 6 and the code interpreted by the compiler started in column 7 and stopped in column 72. Anything from columns 73 through 80 was considered a comment by the compiler. A source of many bugs...
-- Harvey
-
OriginalGriff wrote:
FORTRAN had a line length limit of 80 characters (after that you needed to put a Continuation character in column 7 of the next line),
Close, but the continuation character was in column 6 and the code interpreted by the compiler started in column 7 and stopped in column 72. Anything from columns 73 through 80 was considered a comment by the compiler. A source of many bugs...
-- Harvey
:doh: 6 not 7! I made that mistake too many times when I was at Uni... :sigh: And I had forgotten the auto comment feature as well.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water