Why is it that everybody likes the follwowing curly braces syntax
function() {
implementations ;
}
I find the following much better to read (C style)
function()
{
implementations ;
}
kind regards,
Bart 31 2491
> Why is it that everybody likes the follwowing curly braces syntax function() { implementations ; }
They don't. Some like it and some don't.
I find the following much better to read (C style)
function() { implementations ; }
For style, I follow the ultimate acknowledge reference for English - /The
Elements of Style/.
It says to use parallel construction on parallel concepts.
Don't say, "The big red lion lay down with the lamb, small and furry".
Say, "The big red lion lay down with the small furry lamb."
The adjectives parallel their relation to their noun.
So, in programming, put the curly braces where they parallel each other.
--
Phlip
"bart" <ba**@thatissec ret.nlm> wrote in message
news:3f******** *************** @news.xs4all.nl ... Why is it that everybody likes the follwowing curly braces syntax
function() { implementations ; }
I find the following much better to read (C style)
function() { implementations ; }
I don't think everybody does like the former. I think at least half the
people prefer the latter.
"bart" <ba**@thatissec ret.nlm> wrote in message news:3f******** *************** @news.xs4all.nl ... Why is it that everybody likes the follwowing curly braces syntax
function() { implementations ; }
I find the following much better to read (C style)
function() { implementations ; }
What makes you think the latter is C style? And what makes you think it's
easier to read?
bart wrote: Why is it that everybody likes the follwowing curly braces syntax
function() { implementations ; }
I find the following much better to read (C style)
function() { implementations ; }
kind regards, Bart
Some of us don't like either; they're there to make compiler writers lives
easier, not ours.
While it was 10/10/03 2:50 pm throughout the UK, bart sprinkled little
black dots on a white screen, and they fell thus: Why is it that everybody likes the follwowing curly braces syntax
function() { implementations ; }
I'm one of everybody, amn't I? I personally hate it when people can't
be bothered to indent.
I find the following much better to read (C style)
function() { implementations ; }
Well, I guess that
function() {
implementations ;
}
gives the best of both worlds. :-)
Stewart.
--
My e-mail is valid but not my primary mailbox. Please keep replies on
on the 'group where everyone may benefit.
Hi bart, function() { implementations ; }
This style has a very big advantage when you use a single-line debugger, In
fact not for a function. Try an if instead.
When you use these two cases with a single-line debugger...
if (someboolexpres sion)
dosomething;
if (someboolexpres sion) {
dosomethingmore ;
}
...and the line with an if appears the curly brace tells you that a block is
following. If not one single command follows.
function() { implementations ; }
I personally like this style more. In my opinion it is more readable. But I
do not use a single-line debugger. So I assume that I am not part of
"everybody" .
Regards,
Patrick
Tim Clacy wrote: bart wrote: Why is it that everybody likes the follwowing curly braces syntax
function() { implementations ; }
I find the following much better to read (C style)
function() { implementations ; }
kind regards, Bart
Some of us don't like either; they're there to make compiler writers lives easier, not ours.
....and just to set the cat amongst the pigeons, I'm quite fond of this:
void fn() {
while (...) {
switch (...) {
case :
case :
default : } } }
:-)
bart wrote: Why is it that everybody likes the follwowing curly braces syntax
function() { implementations ; }
I find the following much better to read (C style)
If anything, the former is C-style, as it was used by the originators of
C in K&R. Often refered to as K&R style or OTBS (one true brace style). function() { implementations ; }
I have a preference for Whitesmith's style:
if (1)
{
std::cout << "code!\n";
}
Just pick a style and use it consistently.
Brian Rodenborn This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andrew Koenig |
last post by:
PEP 315 suggests that a statement such as
do:
x = foo()
while x != 0:
bar(x)
be equivalent to
while True:
|
by: Peter Fein |
last post by:
I'm trying to use pyparsing write a screenscraper. I've got some
arbitrary HTML text I define as opener & closer. In between is the HTML
data I want to extract. However, the data may contain the same
characters as used in the closer (but not the exact same text,
obviously). I'd like to get the *minimal* amount of data between these.
Here's an example (whitespace may differ):
from pyparsing import *
|
by: Xah Lee |
last post by:
# -*- coding: utf-8 -*-
# Python
# Matching string patterns
#
# Sometimes you want to know if a string is of
# particular pattern. Let's say in your website
# you have converted all images files from gif
# format to png format. Now you need to change the
# html code to use the .png files. So, essentially
|
by: Stephen |
last post by:
I am unable to get intelligent font matching to work. I used a @font-face
with a Panose-1 descriptor. I tried it with both Internet Explorer 6 and
Firefox on Windows 98 SE. The Panose numbers are from the Windows Registry
key HKEY_LOCAL_MACHINE\Software\Microsoft\Shared Tools\Panose. I am unsure
if I made a coding error, or if the browsers do not support intelligent font
matching, or if there is some other cause.
In the example shown...
|
by: Chris Mantoulidis |
last post by:
There is a LARGE number of syntax styles in most (if not all)
programming languages.
For example, one syntax style (my current one):
....
int main()
{
for (int i = 0; i < 50; i++)
{
| |
by: Bob hotmail.com> |
last post by:
Everyone
I have been spending weeks looking on the web for a good tutorial on how to use regular expressions and other methods to satisfy my craving for learning how to do FAST c-style syntax highlighting in C# but I have yet to find anything useful
I know there are people at MS that know this stuff like the front of their hand and I know there are many people out on the web that are proficient in doing this as well but it seems nobody...
|
by: Xah Lee |
last post by:
the Python regex documentation is available at:
http://xahlee.org/perl-python/python_re-write/lib/module-re.html
Note that, i've just made the terms of use clear.
Also, can anyone answer what is the precise terms of license of the
official python documentation? The official python.org doc site is not
clear.
Note also, that the regex syntax used by Perl is the same as Python.
|
by: Magnus.Moraberg |
last post by:
multipleSpaces = re.compile(u'\\h+')
importantTextString = '\n \n \n \t\t '
importantTextString = multipleSpaces.sub("M", importantTextString)
I would have expected consecutive spaces and tabs to be replaced by M
but nothing is being replaced. If I try the following, then I'm left
only with M, as expected -
multipleSpaces = re.compile(u'\\s+') # both vertical and horizontal
|
by: REH |
last post by:
It it permissible to use the constructor style cast with primitives
such as "unsigned long"? One of my compilers accepts this syntax, the
other does not. The failing one chokes on the fact that the type is
not a single identifier or keyword. Which one is correct? For example:
unsigned long x = unsigned long(y);
REH
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |