CompuServe Messages

#Baffled by Benchmark

    05-Dec-87 04:36:40
Fm: D. J. BAUCH 73157,112
To: John Draper 76703,4322
I suppose I am jumping to C's defense…but, how are strings a kludge in C? I have programmed in many HOLs, and when I came to C, I remember saying to myself "At last, a language with a decent concept of strings." (This was after COBOL, Pascal, a little FORTRAN, and ALGOL). From previous messages in this thread, it looks like Modula-2 is not quite as comfortable doing all kinds of things with strings as C. A C programmer is quite comfortable with the fact that the address of a string is the same as the address of the string's first character, since strings are just "array of char" or "pointer to char", these being interchangeable in C. In C: char *mystring; /* or char mystring[]; */ mystring = "Hello World"; myfunc(mystring); means: Assign the address of the start of the string "Hello World" to mystring Call myfunc with mystring (the address of aforementioned string) and myfunc("Hello World") means call myfunc with the address of "Hello World" Perhaps in Modula-2: mystring := "Hello World"; myfunc(/*whatever the appropriate stuff is*/ mystring); means call myfunc with the address of "Hello World", while myfunc("Hello World") means: Call myfunc, pushing 12 characters in "Hello World" onto the stack for processing by myfunc? Am I way off here? It should be obvious by now that I don't know Modula-2 from JOVIAL. 🙂