That needs to be fptr* f = z;
Sent from a mobile device, please excuse typos.
Hi,
Sorry I fat fingered an earlier send in the previous email. I was
trying to say:>> +1 Exactly this.
>> I don't think C programmer will not understand using. The "=" makes
it much
>> simpler to read, even if it is the first time you see it, which is
not the
>> case of typedef.
>>
>> typedef MyType::NestedType (*fptr)(const MyOhterType&);
>> or
>> using fptr = MyType::NestedType (*)(const MyOhterType&);
>I would prefer to please keep using typedefs at least for function
pointers. I find either oftypedef MyType::NestedType (*fptr)(const MyOhterType&);
or
typedef int fptr(const int&);
void f(fptr* ptr) {
...
}easier to read than the "using" declaration (especially the second
form, with the explicit `fptr* ptr`).Not sure I follow. You're saying this:
typedef int func_type(const int&);
is easier for you to read than this:
using func_type = int(const int&);
?
I never saw syntax
typedef int funct_type(const int&);
I tried to use it and I got compile error for code:
int z(const int&);int main() {
typedef int fptr(const int&);fptr f = z;
That needs to be fptr* f = z;
Yeah. It was confusing in the original example to have "ptr" in the name of
the typedef. Usually it is more like:
typedef int callback_func(void *closure);
int foo(callback_func *cb) {
// ...
}
(though this style is pretty rare in my experience, and results in the
callback_func name being a weird type that you can't assign or do other
stuff with).
-- Sean Silva
Sent from a mobile device, please excuse typos.
Hi,
Sorry I fat fingered an earlier send in the previous email. I was
trying to say:>> +1 Exactly this.
>> I don't think C programmer will not understand using. The "=" makes
it much
>> simpler to read, even if it is the first time you see it, which is
not the
>> case of typedef.
>>
>> typedef MyType::NestedType (*fptr)(const MyOhterType&);
>> or
>> using fptr = MyType::NestedType (*)(const MyOhterType&);
>I would prefer to please keep using typedefs at least for function
pointers. I find either oftypedef MyType::NestedType (*fptr)(const MyOhterType&);
or
typedef int fptr(const int&);
void f(fptr* ptr) {
...
}easier to read than the "using" declaration (especially the second
form, with the explicit `fptr* ptr`).Not sure I follow. You're saying this:
typedef int func_type(const int&);
is easier for you to read than this:
using func_type = int(const int&);
?
I never saw syntax
typedef int funct_type(const int&);
I tried to use it and I got compile error for code:
int z(const int&);int main() {
typedef int fptr(const int&);fptr f = z;
That needs to be fptr* f = z;
That make sense!
Yeah. It was confusing in the original example to have "ptr" in the name
of the typedef. Usually it is more like:typedef int callback_func(void *closure);
int foo(callback_func *cb) {
// ...
}(though this style is pretty rare in my experience, and results in the
callback_func name being a weird type that you can't assign or do other
stuff with).-- Sean Silva
Yep, I have never seen it in LLVM code.
Can we get at least a summary of any decisions made before action is taken? I’m definitely not reading this thread in detail and I doubt others are either.
Philip