Re: You guys didn't tell me something important when programming

  • From: Dave <davidct1209@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Mon, 19 Jul 2010 01:04:41 -0700

As everyone else has stated, whitespace doesn't matter in C++ code
(besides when delimiting variable/keywords via spaces) and you can
actually write your entire program as a single line (i.e.
int main(){cout << "hello world!";return 0;}
will actually work properly though very bad style.

Could you possibly be referring to closing parens, braces, etc?  It's
certainly true that those need to be always entered in pairs (i.e. you
must always have a closing paren for each opening paren in your code).
 For sighted folks, lining up lines helps them keep the code
structured so that at a glance, they can see by the indentation level
where the current block of the code path is.   But, this isn't
strictly required and people do this in different ways (i.e. tabs vs
spaces, number of tab/spaces, etc.).

hth,
Dave

On 7/18/10, Tyler Littlefield <tyler@xxxxxxxxxxxxx> wrote:
> I'm not sure what your smoking, but white-space doesn't matter, at least not
> in c++.
>               Thanks,
> Tyler Littlefield
>       http://tds-solutions.net
>       Twitter: sorressean
>
> On Jul 18, 2010, at 10:45 PM, Jes wrote:
>
>> Hi guys,
>>
>> I learned something tonight. I learned that if you don't line the braces
>> up with each other, as well as the tabs, the parentheses and so on, the
>> program won't compile, even if it is coded correctly.
>> Jes
>>
>> __________
>> View the list's information and change your settings at
>> //www.freelists.org/list/programmingblind
>>
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
>
__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: