Ask Slashdot: What Are the Strangest Features of Various Programming Languages?
itwbennett writes: Every programming language has its own unique quirks, such as weird syntax, unusual functionality or non-standard implementations -- things that can cause developers new to the language, or even seasoned pros, to scratch their heads in wonder (or throw their hands up in despair). Phil Johnson has rounded up some of the strangest — from the + operator in JavaScript to the trigraphs in C and C++ and indentation level in Python. What programming language oddities cause you the most grief?"
C was designed to be a portable assembler.
In assembly it is very common to reuse the "register flags" that get set after an assignment.
E.g. the famous and simple strcpy function in C (a two liner plus signature) is in 68k assembly also only a two liner:
loop:
move.b (A0)+, (A1)+
bne loop
The loop runs until a zero value is moved.
izeof(string)
That does not return the size of a byte but the size of a pointer as a string is a pointer 'char's. Seems you missed the existence of the strlen function.
- strings terminated by a binary zero rather than their physical size. Who the hell thought that would be a good idea?
Well, age old argument. Basically a matter of taste or sadly a historical "evolution".
Modern languages like Java and C# allow arbitrary long strings and store ofc the size.
In older times we only had the Pascal world, where the first byte indicated the size of the string and the C world where a zero byte terminated the string.
Other 'worlds' like Fortran and Cobol only had fixed sized strings and padded the end of the string with blanks.
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
http://stackoverflow.com/quest...
That's a list of very strange language features. Unsurprisingly, Javascript makes many, many appearances.
-- "So they told me that using the download page to download something was not something they anticipated." - Bill Gates
In Python 3, they're keywords:
Dewey, what part of this looks like authorities should be involved?