[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Lies in education [was Re: The "loop and a half"]

On 11/10/2017 15:52, breamoreboy at gmail.com wrote:
> On Wednesday, October 11, 2017 at 3:14:51 PM UTC+1, bartc wrote:
>> On 11/10/2017 14:16, Marko Rauhamaa wrote:
>>> Python and C don't try to protect you. In return, you get syntactic
>>> convenience that probably enhances the quality of your programs.
>> Python, maybe. C syntax isn't as painful as C++ but I still have a lot
>> of trouble with it. (Eg. the variable declaration 'char(*(*x[3])())[5]'.
>> The name of the variable can be found lurking in that lot somewhere, but
>> what's the type?) Not so convenient.

> https://cdecl.org/ tells me that your variable declaration is a syntax error so maybe not much of an example.

Perhaps you didn't write or paste it properly. The site tells me that:


(with or without a trailing semicolon) means:

    declare x as array 3 of pointer to function returning pointer to
    array 5 of char

(Example taken from page 122 of the C book "K&R2", in a section about 
writing a program to make sense of complex declarations.)

Anyway that fact you either tripped up on typing it, or that you had to 
use a special tool to find out what it meant, sort of reinforces my point...