curly-braces

What do curly braces by themselves mean in java?

for example, I have the following code (generated, not written) if(node.getId() != null) { node.getId().apply(this); } { List<PExp> copy = new ArrayList<PExp>(node.getArgs()); for(PExp e : copy) { e.apply(this); } } outAMethodExp(node); What do those extra curly...

Do you use curly braces for additional scoping?

I mean other than using it when required for functions, classes, if, while, switch, try-catch. I didn't know that it could be done like this until I saw this SO question. In the above link, Eli mentioned that "They use it to fold up their code in logical sections that don't fall into a function, class, loop, etc. that would usually be ...

Eclipse jump to closing brace

What is the keyboard short cut in Eclipse to jump to the closing brace of a scope? ...

Is there any IDE or Visual Studio/Mono/SharpDevelop plugin for braceless C#?

When I saw this article about using a python-like sintax (indentation based, without curly braces, syntax) for C#, I begun to wonder: can I have an IDE that parses and compiles it? ...

How do you escape curly braces in javadoc inline tags, such as the {@code} tag.

/** * Gets the meatball icon for a nincompoop. * * <p> * Example: {@code <custom:meatball color="<%= Meatball.RED %> nincompoop="${person}" />} * * @author King Cong * */ The "${person}" part breaks the doc comment because it uses curly braces. Thanks in advance, LES ...

When do you use code blocks?

When do you use code blocks in C/C++/C#, etc.? I know the theoretical reason behind them, but when do you use them in real programs? EDIT: I have just realised that I use them in switch statements, where variables would otherwise be in the same scope (grr for things like i): switch (x) { case "abc": { /* code */ } break; } etc (Just ...

How to set curly braces'/parentheses'/square brackets'/arithmetic operators' syntax highlight color in VIM?

How do I highlight operators/parentheses/brackets/etc. in VIM? I'm not interested in coloring matching or unmatching parentheses/brackets. I've tried ":hi cBracket/whatnot guifg=something" and ":hi Operator/cOperator guifg=something" but these don't seem to affect anything. ...

Does bracket placement affect readability?

Possible Duplicates: Formatting of if Statements Is there a best coding style for identations (same line, next line)? Best way to code stackoverflow style 'questions' / 'tags' rollover buttons public void Method { } or public void Method { } Besides personal preference is there any benefit of one style over another? ...

Reformat C++ braces without changing indentation?

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,...

What are the names of the different Bracing/Indenting styles in C/PHP/Java etc?

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. ...

PHP curly brace syntax for member variable

First question on SO and it's a real RTFM candidate. But I promise you I've looked and can't seem to find it. I'll happily do a #headpalm when it turns out to be a simple thing that I missed. Trying to figure out Zend Framework and came across the following syntax: $this->_session->{'user_id'} I have never seen the curly braces synta...

Cuddle braces in flex

How can I force flex to cuddle my curly-braces instead of putting them on a new line? ...

Go to Matching Brace in Visual Studio?

Is there a way in Visual Studio 2008 to go from a closing brace to it's opening brace? I've found a fair amount of stuff about highlighting the brace, but nothing about moving the cursor to it. ...

Initializing temporary aggregate object using curly braces.

Let's say I have a class: class Aggregate { public: int x; int y; }; I know how to initialize an object using curly braces: Aggregate a1 = { 1500, 2900 }; But I can't find a proper syntax to create temporary object and pass it as an argument to some method, for example: void frobnicate(const Aggregate& arg) { // do...

Why enclose blocks of C code in curly braces?

I am looking at some C code, and have noticed it is full of these curly braces surrounding blocks of code without any sort of control structure. Take a look-see: //do some stuff . . . fprintf(stderr, "%.2f sec\n", (float)(clock() - t) / CLOCKS_PER_SEC); { //a block! why not? char *tmp_argv[3]; tmp_argv[0] = argv[0]; tmp_arg...

Autohotkey choking on curly brace in simple If's

I have a problem with Autohotkey telling me there was a missing { in front of an else where I think my Code is perfectly fine (and worked until before I changed the window-related if's from Pidgin to qutIM) ^!p:: IfWinExist ahk_class QWidget, ,qutIM{ ;if there is a qutIM-window other than the buddy-list... IfWinNotActive ahk_class...

C code involving {}

I saw this in some C code: Wininfo W = { sizeof(Wininfo) }; What the heck does this mean? ...

Curly braces without variable declaration

Why sometimes C code gets wrapped with curly braces without declaring a variable in them? e.g. (from FreeRTOS source code, file 'tasks.c'): portENTER_CRITICAL(); { xTicks = xTickCount; } portEXIT_CRITICAL(); ...

C# scoping operator

back in school, we wrote a compiler where curly braces had the default behavior of executing all expressions, and returning the last value... so you could write something like: int foo = { printf("bar"); 1 }; Is there something equivalent in C#? For instance, if I want to write a lambda function that has a side effect. The point les...

PCRE: Find matching brace for code block

Is there a way for PCRE regular expressions to count how many occurrences of a character it encounters (n), and to stop searching after it has found n occurrences of another character (specifically { and }). This is to grab code blocks (which may or may not have code blocks nested inside them). If it makes it simpler, the input will be...