naming-conventions

Naming convention for params of ctors and setters

旧巷老猫 提交于 2019-12-19 02:06:29
问题 For those of you who name you member variables with no special notation like m_foo or foo_ , how do you name parameters to your ctors and setters? Some options I've tried so far... Obj(int foo) : foo(foo) { } void set_foo(int foo) { this->foo = foo; } Obj(int _foo) : foo(_foo) { } void set_foo(int _foo) { foo = _foo; } Obj(int a_foo) : foo(a_foo) { } // a for "argument" void set_foo(int a_foo) { foo = a_foo; } Obj(int init_foo) : foo(init_foo) { } void set_foo(int new_foo) { foo = new_foo; }

The meaning of ' in Haskell function name?

女生的网名这么多〃 提交于 2019-12-18 20:07:25
问题 What is quote ' used for? I have read about curried functions and read two ways of defining the add function - curried and uncurried. The curried version... myadd' :: Int -> Int -> Int myadd' x y = x + y ...but it works equally well without the quote. So what is the point of the ' ? 回答1: The quote means nothing to Haskell. It is just part of the name of that function. People tend to use this for "internal" functions. If you have a function that sums a list by using an accumulator argument,

How to deal with duplicated function name within C?

旧城冷巷雨未停 提交于 2019-12-18 19:07:35
问题 I have a little project in which I named two same name function in two different source file, but while I building the project, the compiler failed with 'func_name already defined in filename.obj'. Why could not I have two functions with the same name in two different source files? I thought the function should be local to the source file only if when we declared it in the header file will it become global. And except for changing the filename, are there any other elegant solution to

When should I use the dollar symbol ($) in a variable name?

99封情书 提交于 2019-12-18 19:06:26
问题 The dollar symbol ($) is a valid character to name a variable, e.g. String superSecretFormula$; , but when we're talking about naming conventions, when should I use this symbol? Underscore for example is most used to separate words, as blank spaces are not allowed. 回答1: From the Java Language Specification on identifiers: The $ character should be used only in mechanically generated source code or, rarely, to access pre-existing names on legacy systems. 回答2: Your question is tagged Java, but

What is proper naming convention for MSVC dlls, static libraries and import libraries

醉酒当歌 提交于 2019-12-18 15:11:52
问题 What is standard or "most-popular" naming convention for MSVC library builds. For example, for following platforms library foo has these conventions: Linux/gcc: shared: libfoo.so import: --- static: libfoo.a Cygwin/gcc: shared: cygfoo.dll import: libfoo.dll.a static: libfoo.a Windows/MinGW: shared: libfoo.dll import: libfoo.dll.a static: libfoo.a What should be used for MSVC buidls? As far as I know, usually names are foo.dll and foo.lib , but how do you usually distinguish between import

What is proper naming convention for MSVC dlls, static libraries and import libraries

北城以北 提交于 2019-12-18 15:11:14
问题 What is standard or "most-popular" naming convention for MSVC library builds. For example, for following platforms library foo has these conventions: Linux/gcc: shared: libfoo.so import: --- static: libfoo.a Cygwin/gcc: shared: cygfoo.dll import: libfoo.dll.a static: libfoo.a Windows/MinGW: shared: libfoo.dll import: libfoo.dll.a static: libfoo.a What should be used for MSVC buidls? As far as I know, usually names are foo.dll and foo.lib , but how do you usually distinguish between import

javax.el.PropertyNotFoundException when trying to resolve Boolean properties in EL

六月ゝ 毕业季﹏ 提交于 2019-12-18 15:05:11
问题 I have the following tree node class: public abstract class DocumentTreeNode extends TreeNodeImpl implements javax.swing.tree.TreeNode { private Boolean isToC; ... public Boolean isToC() { return isToC; } public void setToC(Boolean isToC) { this.isToC = isToC; } } This is a simple check box indicating whether the document is to be included in whatever or not. However, when trying to reference this from within JSF 2 EL ... <h:selectBooleanCheckbox value="#{node.isToC}" /> ... I get an

When should I name things with initial capital letters?

拜拜、爱过 提交于 2019-12-18 12:54:18
问题 I have always wondered when to use identifiers (for example, functions) with capital first letter instead of camel case. I always write my JS in camel case like this: function doStuff() {} var simpleVar = 'some stuff', myAry = [], myObj = {}; ... But I know I am supposed to name some things with capital first letters. I just don't know WHEN this rule applies. Hope somebody can make things a bit clearer to me. 回答1: According to the book "Javascript: the good parts", you should only capitalise

Why does Objective-C use YES/NO macro convention instead of true/false?

我怕爱的太早我们不能终老 提交于 2019-12-18 12:14:45
问题 Most languages use the true/false keywords for boolean values. I found that even Smalltalk is using true/false . I know Objective-C is just borrowing concepts from Smalltalk, not the language itself, but I'm curious why it's using YES/NO instead of the more widely-used true/false . Is there any historical reason? 回答1: Objective-C was designed to be (and still is) a strict superset of C. The creators worked very hard to ensure that they did not break compatibility with C in any way. They also

Naming Conventions in C# - underscores

谁说我不能喝 提交于 2019-12-18 11:41:48
问题 I saw this at an MVC3 Razor tutorial at http://www.asp.net public ActionResult Index() { return View(_usrs._usrList); } Isn't that usage plain wrong? I have always thought that [docs] In C#, I usually see it used only when defining the underlying private member variable for a public property. Other private member variables would not have an underscore. This usage has largely gone to the wayside with the advent of automatic properties though. Or is it a new naming convention I am seeing? Very