Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
160 views
in Technique[技术] by (71.8m points)

c++ - What is the right way to typedef a type and the same type's pointer?

What is the right way to typedef a type and the same type's pointer? Here is what I mean. Should I do this:

typedef unsigned int delay;
typedef unsigned int * delayp;

Or should I do this:

typedef unsigned int delay;
typedef delay * delayp;

Or perhaps I should not typedef pointer at all and just use delay * instead of delayp everywhere I find necessary?

Thanks, Boda Cydo.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The right way is not to do it. Hiding the fact that something is a pointer is commonly seen as bad style.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...