Click here to Skip to main content
15,888,984 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralShameless plug Pin
Vikram A Punathambekar29-Nov-20 2:35
Vikram A Punathambekar29-Nov-20 2:35 
GeneralRe: C declarations are half backward Pin
PIEBALDconsult29-Nov-20 4:13
mvePIEBALDconsult29-Nov-20 4:13 
GeneralRe: C declarations are half backward Pin
theoldfool29-Nov-20 12:20
professionaltheoldfool29-Nov-20 12:20 
GeneralRe: C declarations are half backward Pin
Mike Winiberg29-Nov-20 21:18
professionalMike Winiberg29-Nov-20 21:18 
GeneralRe: C declarations are half backward Pin
honey the codewitch30-Nov-20 4:00
mvahoney the codewitch30-Nov-20 4:00 
GeneralRe: C declarations are half backward Pin
Mike Winiberg30-Nov-20 4:33
professionalMike Winiberg30-Nov-20 4:33 
GeneralRe: C declarations are half backward Pin
W Balboos, GHB30-Nov-20 5:20
W Balboos, GHB30-Nov-20 5:20 
GeneralRe: C declarations are half backward Pin
Joop Eggen29-Nov-20 23:25
Joop Eggen29-Nov-20 23:25 
Java's stupid (=political) C compatibility

C started as a simple language on top of assembly language. Lingual considerations of abstractional consistency had no priority. As error awareness. Everything is an int, boolean, pointer, array, functions.

In fact declarations have a weird kind of syntax requiring a large parsing. Or for a human a bit of back-and-forth reading.

As java was launched, it intended to improve some parts of C++/C. So in java the entire type info becomes separate from the variable.
Java
char[] jarr; // Normal java.

But as novice java kept the C style for accustomed C/C++ programmmers:
Java
char jarr[]; // Obsolete C style java.

If one looks at java's:
Java
char[] jarr = new char[1024];

one get's an idea why C chose:
C
char str[1024];

The 1024 is not part of the `char*` data structure as field, but some compile time allocation.

In general one should accept C as it is: a compiler strong, thin layered, fun language.

For language features it is pedagogical unsuited w.r.t. type systems, actual data, error prevention and so on. Taking any language, like a simple Pascal, might give less confusion with pointer versus array like in parameter passing. Then going back to C one sees that arrays are passed as pointers i.o. the pointed-to data as in Pascal.
GeneralRe: C declarations are half backward Pin
Rusty Bullet30-Nov-20 3:52
Rusty Bullet30-Nov-20 3:52 
GeneralRe: C declarations are half backward Pin
honey the codewitch30-Nov-20 3:55
mvahoney the codewitch30-Nov-20 3:55 
GeneralRe: C declarations are half backward Pin
Kirk 1038982130-Nov-20 4:18
Kirk 1038982130-Nov-20 4:18 
GeneralRe: C declarations are half backward Pin
honey the codewitch30-Nov-20 4:26
mvahoney the codewitch30-Nov-20 4:26 
GeneralRe: C declarations are half backward Pin
Kirk 1038982130-Nov-20 4:37
Kirk 1038982130-Nov-20 4:37 
GeneralRe: C declarations are half backward Pin
honey the codewitch30-Nov-20 4:46
mvahoney the codewitch30-Nov-20 4:46 
GeneralRe: C declarations are half backward Pin
Kirk 1038982130-Nov-20 6:37
Kirk 1038982130-Nov-20 6:37 
GeneralRe: C declarations are half backward Pin
honey the codewitch30-Nov-20 6:39
mvahoney the codewitch30-Nov-20 6:39 
GeneralRe: C declarations are half backward Pin
BernardIE531730-Nov-20 5:50
BernardIE531730-Nov-20 5:50 
GeneralRe: C declarations are half backward Pin
honey the codewitch30-Nov-20 5:51
mvahoney the codewitch30-Nov-20 5:51 
GeneralRe: C declarations are half backward Pin
BernardIE531730-Nov-20 6:02
BernardIE531730-Nov-20 6:02 
GeneralRe: C declarations are half backward Pin
honey the codewitch30-Nov-20 6:04
mvahoney the codewitch30-Nov-20 6:04 
GeneralRe: C declarations are half backward Pin
BernardIE531730-Nov-20 6:22
BernardIE531730-Nov-20 6:22 
GeneralRe: C declarations are half backward Pin
honey the codewitch30-Nov-20 6:24
mvahoney the codewitch30-Nov-20 6:24 
GeneralRe: C declarations are half backward Pin
BernardIE531730-Nov-20 8:38
BernardIE531730-Nov-20 8:38 
GeneralRe: C declarations are half backward Pin
Stuart Dootson30-Nov-20 5:53
professionalStuart Dootson30-Nov-20 5:53 
GeneralRe: C declarations are half backward Pin
Stuart Dootson30-Nov-20 5:52
professionalStuart Dootson30-Nov-20 5:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.