enum types - outputting the label

Started by
10 comments, last by sutek 23 years, 2 months ago
quote:Original post by Gorg

it can be
int* i; //integer pointer
also. If you ever work for a software company, the coding standard is usually that you use int* instead of int because it is clearer



Actually, that would make things less clear. When you use ''int *i'' you know that the * goes with the variable name. Using ''int* i'' sounds like all proceeding variables will be of type int*, which isn''t true. IE, ''int* i, j;'' creates a pointer to an integer (i) and a straight integer (j) even though the syntax would lead you to believe otherwise.

BTW, the software companies I''ve worked for have never used the ''int*'' standard. Of course, I''ve only worked for a few so...


- Houdini
- Houdini
Advertisement
quote:Original post by Houdini

Original post by Gorg

it can be
int* i; //integer pointer
also. If you ever work for a software company, the coding standard is usually that you use int* instead of int because it is clearer



Actually, that would make things less clear. When you use ''int *i'' you know that the * goes with the variable name. Using ''int* i'' sounds like all proceeding variables will be of type int*, which isn''t true. IE, ''int* i, j;'' creates a pointer to an integer (i) and a straight integer (j) even though the syntax would lead you to believe otherwise.

BTW, the software companies I''ve worked for have never used the ''int*'' standard. Of course, I''ve only worked for a few so…


- Houdini

Yes, but int* i; tells you that the type is int. someone could have written

int *fajbllejl;aj;

reading rapidly, there is a chance that he misses the * and do not know it is a pointer.

But this is useless fight. It doesn''t really matter which notation you use, as long as everybody in your teams follows the same one.

This topic is closed to new replies.

Advertisement