[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Is google's C++ style guide any good?

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 24
Thread images: 2

File: c-logo.png (33KB, 600x400px) Image search: [Google]
c-logo.png
33KB, 600x400px
IMO all their naming convention is shitty.

How I do it:


global variables:
G_STRING_variablename
G_ARRAYCHAR_variablename

local variables:
L_STRING_variablename
L_ARRAYINT_variablename

local pointer:
L_P_INT_variablename

parameters:
P_P_INT_variablename -> this one is a pointer
P_INT_variablename

This way is much easier to know whatever i'm dealing with.


Function names:

always with capslock: DO_XXX_YYY()
>>
the notion of evaluating style guides by anything external or "objective" is retarded. it's useful as a way of framing your code so that it's internally consistent. the only real evaluation you can apply to it is essentially whether it contains any logical conflicts, like two conflicting rules applying to something.

the style guide is as good as anything else, but if you don't like it then use another one. if none exists, then use it for lack of an alternative.
>>
You've obviously never had to work in the same project with a bunch of people.

The retarded shit I've seen justifies all the naming conventions you want.
>>
Your style is shit and verbose and makes Hungarian look readable
>>
>>56236666
Are you autistic?
>>
whats the best c++ book?
>>
>>56236666
You could just use a proper IDE. That way you know what you're dealing with without making your code a mess.

Also DON't use globals, holy shit.
>>
>>56236666
i can see it now
for (std::vector<int>::const_iterator L_STD__VECTOR__INT__CONST_ITERATOR_it = L_STD__VECTOR__INT.begin(); L_STD__VECTOR__INT__CONST_ITERATOR_it != L_STD__VECTOR__INT.end(); ++L_STD__VECTOR__INT__CONST_ITERATOR_it) {
DO_THIS_WITH_INT(*L_STD__VECTOR__INT__CONST_ITERATOR_it);
// etc
}
>>
>>56237441
whoops, forgot the variable name for the vector
>>
I avoid non-const global variables at all cost, name constants (whether global vars or object-like macros) WITH_NAMES_LIKE_THIS.

Regular variables, are namedLikeThis. asAreFunctionsAndMethods(). There's no special naming style for pointers as distinct from regular variables.

And classes have NamesLikeThis.
>>
>>56236666
Fucking kill yourself.
>>
>>56236666
>Function names:
>always with capslock: DO_XXX_YYY()
objectively retarded
>>
>current year
>not using Rust
Enjoy your memory unsafety
>>
>>56237199
hey now, I am hungarian
>>
>>56237199
>>56240325
not related, it's called hungarian notation

back in the days, BCPL required this kind of faggotry, blame it on Simony Karcsibácsi, nowadays, its fugly and useless(plus nowadays most IDEs will cry out loud when you try to mess up data types)
>>
>>56238633
>>56238474
>>56237408
>>56237263
/thread
>>
>>56237408
> Don't use globals
Then what should i use, singletons? Lmao.
>>
>>56236666
Quads checked...

I recall the shit storm about Hungarian notation from C++ MFC faggots. Happier times...

If you use C++ btw... fucking kill yourself.
>>
File: 1468715317312.png (155KB, 300x468px) Image search: [Google]
1468715317312.png
155KB, 300x468px
most of c++ style guides have the same problems:
1) mix subjective and objective stuff
2) don't offer any working tooling to enforce stated rules
3) don't deal with pluralizm of the existing ecosystem
>>
>>56236666
wew this should be a clear bait. AUTISM STYLE.
>>
>>56240305
M E M E L A N G U A G E S
>>
>>56236666
camelCase > shitty_unatural_to_type_underscrore
>>
>>56236666
Looks like they are using notepad to code. Their naming scheme is a relic from decades ago.
>>
>>56241792
No you pass the value along in the constructor where it is needed.
Thread posts: 24
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.