简体   繁体   中英

Single letter words in camelCase, what is a standard for handling these?

I'm trying to group together an object's vertex X components in a vector, like structure of array style.

Naturally this is the way.

Vec xComponents; or Vec xVals; or simply Vec x;

However sometimes I want to specify in the id what x components belong to, I think about doing this.

Vec objXComponents;

However, the two capitals next to each other seem to break a rule about camel case, and may make it slightly less readable.

What should I do for this case? I know you may say just cull the components post-fix and use objX , and while I think that's OK for this case I would like a general solution / standard.

I tried finding if microsoft has a standard for this but I cant find it on their style guidlines .

objXComponents

seems appropriate.

Why? The "formula" for camel case seems to be as follows:

1- First word in the identifier is all lowercase

2- First letter of the words that follow are uppercase

3- Remaining letters of words that follow are lowercase

If the word is one letter, then that letter is first, so uppercase it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM