Coding Conventions – Naming Enums

Is there a convention for naming enumerations in Java? My preference is that an enum is a type. So, for instance, you have an enum Fruit{Apple,Orange,Banana,Pear, … } NetworkConnectionType{LAN,Data_3g,Data_4g, … } I am opposed to naming it: FruitEnum NetworkConnectionTypeEnum I understand it is easy to pick off which files are enums, but then you would … Read more

What is the standard naming convention for html/css ids and classes? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 10 months ago. The community reviewed whether to reopen this question 3 months ago and left it closed: Original close reason(s) were … Read more

Where do I find the current C or C++ standard documents?

This question’s answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions. For many questions the answer seems to be found in “the standard”. However, where do we find that? Preferably online. Googling can sometimes feel futile, again especially for the C standards, since … Read more

Why aren’t variable-length arrays part of the C++ standard?

I haven’t used C very much in the last few years. When I read this question today I came across some C syntax which I wasn’t familiar with. Apparently in C99 the following syntax is valid: void foo(int n) { int values[n]; //Declare a variable length array } This seems like a pretty useful feature. … Read more

Is there a W3C valid way to disable autocomplete in a HTML form?

When using the xhtml1-transitional.dtd doctype, collecting a credit card number with the following HTML <input type=”text” id=”cardNumber” name=”cardNumber” autocomplete=”off”/> will flag a warning on the W3C validator: there is no attribute “autocomplete”. Is there a W3C / standards way to disable browser auto-complete on sensitive fields in a form? 18 Answers 18

What are the rules about using an underscore in a C++ identifier?

It’s common in C++ to name member variables with some kind of prefix to denote the fact that they’re member variables, rather than local variables or parameters. If you’ve come from an MFC background, you’ll probably use m_foo. I’ve also seen myFoo occasionally. C# (or possibly just .NET) seems to recommend using just an underscore, … Read more

Coding Conventions – Naming Enums

Enums are classes and should follow the conventions for classes. Instances of an enum are constants and should follow the conventions for constants. So enum Fruit {APPLE, ORANGE, BANANA, PEAR}; There is no reason for writing FruitEnum any more than FruitClass. You are just wasting four (or five) characters that add no information. This approach … Read more