We would like to make our C++ brace style more consistent. Right now, our code contains a mix of:
if (cond)
{
// ...
}
else
{
// ...
}
...and:
if (cond) {
// ...
} else {
// ...
}
We want to use the latter style exclusively.
However, we don't want to change the indentation of our code. I've tried using astyle,...
My co-worker is 0 for 2 on questions he has inspired (1, 2), so I thought I'd give him a chance to catch up.
Our latest disagreement is over the style issue of where to put "const" on declarations.
He is of the opinon that it should go either in front of the type, or after the pointer. The reasoning is that this is what is typically do...
Hi
In an object-oriented programming style does how does one tend to handle graphics? Should each object contain its own graphics information? How does that information get displayed?
My experience with making graphical programs is limited, but I have tended to have the objects and the graphics be only loosely related. For instance, i...
I like single line styles in my content pages...like this
.lblLogin {left:14px;top:95px;position:absolute}
.lblPassword {left:14px;top:128px;position:absolute}
When I drop a new control on a page VS creates generic style classes .Style1, .Style2, etc., after renaming them and making them single line, if I move a control on th...
I'm interested in learning about the available choices of high-quality, stand-alone source code formatters for Java.
The formatter must be stand-alone, that is, it must support a "batch" mode that is decoupled from any particular development environment. Ideally it should be independent of any particular operating system as well. So, a ...
I have a particularly stupid insecurity about the aesthetics of my code... my use of white space is, frankly, awkward. My code looks like a geek dancing; not quite frightening, but awkward enough that you feel bad staring, yet can't look away.
I'm just never sure when I should leave a blank line or use an end of line comment instead of...
We are planning to use stylecop for our MVC applicaion.Has anyone used the stylecop for MVC. It would be great if i could get pros and cons for using style cop.
...
In languages that use 'curly braces' for code blocks, and where whitespace isn't a concern (C, Java, PHP) - What are the names for the different bracing/indenting styles?
I remember reading about 'KNF' and 'Flag', but it'd be great to have the most recognized names, along with some simple examples of each.
...
In C#, is there any difference between using System.Object in code rather than just object, or System.String rather than string and so on? Or is it just a matter of style?
Is there a reason why one form is preferrable to the other?
...
Hi,
What are coding conventions and guidelines you suggest for writing Bison (.y) and flex (.lex) files?
Please address the length of the code sections and their style.
Thanks,
Asaf
P.S.,
There's an old thread about it here, but I'm looking for a more detailed answer (and to have it on SO!).
...
procedure MyProc(Eval: Boolean);
begin
if not Eval then
Exit;
/* do stuff */
/* do more stuff */
end;
OR
procedure MyProc(Eval: Boolean);
begin
if Eval then
begin
/* do stuff */
/* do more stuff */
end;
/* no Exit needed, but now we got what I think unp...
function MyFunc: Boolean;
begin
if eval then
Result := True
else
Result := False;
/* Note it's a fancy example, I know that in this case I can do: Result := Eval */
end;
OR
function MyFunc: Boolean;
begin
Result := False;
if eval then
Result := True;
/* good by else statement */
end;
...
When typing code, I would normally close brackets, go back inside, go outside, type semicolon, etc:
I might start with (| is the caret):
System.out.println()|
Then go left:
System.out.println(|)
Then this:
System.out.println(foo()|)
Again backtracking a space:
System.out.println(foo(|))
Typing quotes are similar:
System.out...
Coming from a Python background, where there is always a "right way to do it" (a "Pythonic" way, if you will) when it comes to style, I'm wondering if the same exists for Ruby. I've kind of been using my own style guidelines but I'm thinking about releasing my source code, and I'd like it to adhere to any unwritten rules that might exist...
In the past I've used perl's AUTOLOAD facility for implementing lazy loading of symbols into a namespace, and wanted the same functionality in python.
Traditionally the closest you appear to be able to get is to use a class and a __getattr__ class to achieve this sort of thing. However I've also tried rummaging around in sys.modules, a...
If I have a function with a ton of conditionals what is the best way to organize it?
What I am worried about is someone else coming into the code and understanding what is going on. Even though the example is simple imagine that the conditional is very complex.
For an example:
public void function(string value, string value2)
{
...
For example, I'd like to not indent namespaces in C++ code, but the prefpane doesn't seem to have any place to make a decision of this granularity. Is there some hidden config file or something? Or am I just out of luck?
...
Possible Duplicate:
Optimising asp.net vb code behind
I need to rewrite the below code :
If (storeSelected = 1) Then
tempCollector = tempCollector + "<br>" + "Department" + ": " + txt_panview3_ddinput1.SelectedItem.ToString
tempCollector = tempCollector + "<br>" + "Store" + ": " + txt_panview3_input2.Text + "<br>"
End ...
I have run into this problem across multiple programming languages and I was just wondering what the best way to handle it is.
I have three method calls that fire off asynchronously. Each one has a callback. I want to do something only when all three callbacks have completed.
What is the best way to code this? I usually end up with ...
I had to figure out a way to ask this that wasn't subjective, so this is specifically for Microsoft's coding style. In the ASP.NET MVC source, code files look like this:
// Copyright info
namespace System.Web.Mvc {
using System;
// blah blah
// ...
}
Note that 'using System' lines up nicely with the namespace. If I was...