-
My 2¢: when you have
MyRidiculouslyLongClassNameWhichIDontWantToTypeInEachTimeSoIUseEvilAuto, trytypedef MyRidiculouslyLongClassNameWhichIDontWantToTypeInEachTimeSoIUseEvilAuto Z; Z abc;:)
-
@JonB First of all
using Z = MyRidiculouslyLongClassNameWhichIDontWantToTypeInEachTimeSoIUseEvilAuto;because C++11 :)@VRonin
Sigh, looks like my C knowledge is increasingly invalid :( But I don't see what's wrong withtypedefhere, I'm not using a template.
BTW, I wouldn't really name itZhere, of course I'd useMRLCNWIDWTTIETSIUEAbecause it's much clearer what that means! -
@VRonin
Sigh, looks like my C knowledge is increasingly invalid :( But I don't see what's wrong withtypedefhere, I'm not using a template.
BTW, I wouldn't really name itZhere, of course I'd useMRLCNWIDWTTIETSIUEAbecause it's much clearer what that means! -
@JonB said in Rants about auto:
But I don't see what's wrong with
typedefhereNothing, I was just taking the piss. they are equivalent with the only difference that the
Ztype can be a template withusingwhile it can't withtypedef.@VRonin
Oh, lol! Once I started reading up about this newusingI suspected that now I was supposed to use that every time....With
typedefs you can string them together for a nice extra level of confusion ;) So you writetypedef int I, *PI;which makes me wonder: without you looking it up, if I write:
typedef int *PI, T;is
Ttypeintorint *? :) -
@VRonin
Oh, lol! Once I started reading up about this newusingI suspected that now I was supposed to use that every time....With
typedefs you can string them together for a nice extra level of confusion ;) So you writetypedef int I, *PI;which makes me wonder: without you looking it up, if I write:
typedef int *PI, T;is
Ttypeintorint *? :) -
@kshegunov
Hmm. OK, then, could you please explain how the*binds intypedef int *PI, T;.Why is that
typedefnotint *forT? And if you wanted it to bind asint *forT(i.e. making it same asPI), how could you force that, e.g. something like (I'm sure it's not right):typedef (int *)PI, TP.S.
We are not JS devs, you know
Ummm, relevance? JS doesn't even have type declarations or pointers, so...?
-
@kshegunov
Hmm. OK, then, could you please explain how the*binds intypedef int *PI, T;.Why is that
typedefnotint *forT? And if you wanted it to bind asint *forT(i.e. making it same asPI), how could you force that, e.g. something like (I'm sure it's not right):typedef (int *)PI, TP.S.
We are not JS devs, you know
Ummm, relevance? JS doesn't even have type declarations or pointers, so...?
@JonB said in Rants about auto:
Why is that typedef not int * for T?
Not 100% about the theory behind it, but it's like with initialization (I assume it's cause
,has very low priority). Say you have:char * p, n;pischar *, butnischar.And if you wanted it to bind as int * for T (i.e. making it same as PI), how could you force that, e.g. something like (I'm sure it's not right):
typedef int *PI, *T;Ummm, relevance? JS doesn't even have type declarations or pointers, so...?
Simply an ill-concealed insult. :)
PS:
Simply an ill-concealed insult.
-
@JonB said in Rants about auto:
Why is that typedef not int * for T?
Not 100% about the theory behind it, but it's like with initialization (I assume it's cause
,has very low priority). Say you have:char * p, n;pischar *, butnischar.And if you wanted it to bind as int * for T (i.e. making it same as PI), how could you force that, e.g. something like (I'm sure it's not right):
typedef int *PI, *T;Ummm, relevance? JS doesn't even have type declarations or pointers, so...?
Simply an ill-concealed insult. :)
PS:
Simply an ill-concealed insult.
typedef int *PI, *T;That is cheating! You know it. You know that I know it can be done that way, that wasn't the question. I want the
*s to be included in the "base" part of thetypedefI am declaring, so that I can write like:typedef (int **********) PI, PI2_same_as_PI, *PI3_one_extra_pointer;I don't want to repeat the
*s, and I don't want to declare a separate, intermediatetypedefto achieve it.As you say, thinking about the
typedefjust like a list-of-variables declaration, I guess it cannot be done? The*s just aren't a part of the "base" type being declared, they belong only to each type-name/variable being declared individually? And this is why we tend/are encouraged to writechar *pand notchar* pin C.As for the JS. I know I am a cheerleader for C compared to C++, but I have never said I am a fanboi for all the JS stuff I have had to write over the years.
-
typedef int *PI, *T;That is cheating! You know it. You know that I know it can be done that way, that wasn't the question. I want the
*s to be included in the "base" part of thetypedefI am declaring, so that I can write like:typedef (int **********) PI, PI2_same_as_PI, *PI3_one_extra_pointer;I don't want to repeat the
*s, and I don't want to declare a separate, intermediatetypedefto achieve it.As you say, thinking about the
typedefjust like a list-of-variables declaration, I guess it cannot be done? The*s just aren't a part of the "base" type being declared, they belong only to each type-name/variable being declared individually? And this is why we tend/are encouraged to writechar *pand notchar* pin C.As for the JS. I know I am a cheerleader for C compared to C++, but I have never said I am a fanboi for all the JS stuff I have had to write over the years.
@JonB said in Rants about auto:
I don't want to repeat the *s, and I don't want to declare a separate, intermediate typedef to achieve it.
Then you're out of luck.
And this is why we tend/are encouraged to write
That's just style. I write spaces on both sides:
char * p; char ** p;and so on.
I know I am a cheerleader for C compared to C++
That's like being cheerleader for FORTRAN against C. ;)
but I have never said I am a fanboi for all the JS stuff I have had to write over the years.
Granted. I was just making fun of JS devs. ;P
-
@JonB said in Rants about auto:
I don't want to repeat the *s, and I don't want to declare a separate, intermediate typedef to achieve it.
Then you're out of luck.
And this is why we tend/are encouraged to write
That's just style. I write spaces on both sides:
char * p; char ** p;and so on.
I know I am a cheerleader for C compared to C++
That's like being cheerleader for FORTRAN against C. ;)
but I have never said I am a fanboi for all the JS stuff I have had to write over the years.
Granted. I was just making fun of JS devs. ;P
@kshegunov
The declaration layout is just style, but I meant thatchar *pinstead ofchar* pmakes clear how C type declarations with*actually bind, relevant if you have a list of them (char *p, *qbetter thanchar* p, *q). -
@JonB said in Rants about auto:
Why is that typedef not int * for T?
Not 100% about the theory behind it, but it's like with initialization (I assume it's cause
,has very low priority). Say you have:char * p, n;pischar *, butnischar.And if you wanted it to bind as int * for T (i.e. making it same as PI), how could you force that, e.g. something like (I'm sure it's not right):
typedef int *PI, *T;Ummm, relevance? JS doesn't even have type declarations or pointers, so...?
Simply an ill-concealed insult. :)
PS:
Simply an ill-concealed insult.
Hi,
@kshegunov said in Rants about auto:Can please someone tell me what environment is using Gary Bernhardt in that video ?
-
Hi,
@kshegunov said in Rants about auto:Can please someone tell me what environment is using Gary Bernhardt in that video ?
-
Hi,
@kshegunov said in Rants about auto:Can please someone tell me what environment is using Gary Bernhardt in that video ?
I believe it's
zshthat he uses, otherwise Jon's right, he just starts the interpreters from the command line. -
I believe it's
zshthat he uses, otherwise Jon's right, he just starts the interpreters from the command line.@kshegunov
And the relevance of it being specificallyzshis... what? :) You just looking for extra points? ;-) -
@kshegunov
And the relevance of it being specificallyzshis... what? :) You just looking for extra points? ;-)@JonB said in Rants about auto:
And the relevance of it being specifically
zshis... what?Environment of the interpreter.
You just looking for extra points?
Yep! Gimme, gimme!
Qt 6.11 is out! See what's new in the release
blog