FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 12-21-2011, 10:00 PM
Dan McGee
 
Default Add note to HACKING about operator spacing

---
HACKING | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/HACKING b/HACKING
index 6692f7e..adfa94b 100644
--- a/HACKING
+++ b/HACKING
@@ -90,6 +90,17 @@ alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
NOT
if(!strcmp(a, b))

+8. Use spaces around almost all arithmetic, comparison and assignment
+ operators and after all ',;:' separators.
+
+ foobar[2 * size + 1] = function(a, 6);
+ NOT
+ foobar[2*size+1]=function(a,6);
+
+ for(a = 0; a < n, n > 0; a++) {}
+ NOT
+ for(a=0;a<n,n>0;a++) {}
+

Other Concerns
--------------
--
1.7.8
 
Old 12-21-2011, 10:08 PM
Diogo Sousa
 
Default Add note to HACKING about operator spacing

On 12/21/2011 11:00 PM, Dan McGee wrote:
> ---
> HACKING | 11 +++++++++++
> 1 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/HACKING b/HACKING
> index 6692f7e..adfa94b 100644
> --- a/HACKING
> +++ b/HACKING
> @@ -90,6 +90,17 @@ alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
> NOT
> if(!strcmp(a, b))
>
> +8. Use spaces around almost all arithmetic, comparison and assignment
> + operators and after all ',;:' separators.
> +
> + foobar[2 * size + 1] = function(a, 6);
> + NOT
> + foobar[2*size+1]=function(a,6);
> +
> + for(a = 0; a < n, n > 0; a++) {}
> + NOT
> + for(a=0;a<n,n>0;a++) {}
> +
>
> Other Concerns
> --------------

Don't you what a < n && n > 0 instead of a < n, n > 0?

(I know it is valid c code, but it only makes sense if it has a side-effect)

Diogo Sousa
 
Old 12-21-2011, 10:12 PM
Dan McGee
 
Default Add note to HACKING about operator spacing

On Wed, Dec 21, 2011 at 5:08 PM, Diogo Sousa <diogogsousa@gmail.com> wrote:
> On 12/21/2011 11:00 PM, Dan McGee wrote:
>> ---
>> *HACKING | * 11 +++++++++++
>> *1 files changed, 11 insertions(+), 0 deletions(-)
>>
>> diff --git a/HACKING b/HACKING
>> index 6692f7e..adfa94b 100644
>> --- a/HACKING
>> +++ b/HACKING
>> @@ -90,6 +90,17 @@ alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
>> * * * * NOT
>> * * *if(!strcmp(a, b))
>>
>> +8. *Use spaces around almost all arithmetic, comparison and assignment
>> + * *operators and after all ',;:' separators.
>> +
>> + * * foobar[2 * size + 1] = function(a, 6);
>> + * * * *NOT
>> + * * foobar[2*size+1]=function(a,6);
>> +
>> + * * for(a = 0; a < n, n > 0; a++) {}
>> + * * * *NOT
>> + * * for(a=0;a<n,n>0;a++) {}
>> +
>>
>> *Other Concerns
>> *--------------
>
> Don't you what a < n && n > 0 instead of a < n, n > 0?
>
> (I know it is valid c code, but it only makes sense if it has a side-effect)
Haha, whoops- contrived example. Meant something more like:

>> + for(a = 0; a < n && n > 0; a++, n--) {}
>> + NOT
>> + for(a=0;a<n&&n>0;a++,n--) {}

To show that commas too need spaces.
 

Thread Tools




All times are GMT. The time now is 03:03 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org