Re: [E-devel] E SVN: lucas IN trunk/embryo/src: bin lib

2010-08-16 Thread The Rasterman
On Thu, 12 Aug 2010 08:21:10 -0300 Lucas De Marchi
lucas.demar...@profusion.mobi said:

 On Wed, Aug 11, 2010 at 6:36 PM, Michael Jennings m...@kainx.org wrote:
  I'm all for consistency, and this is certainly a great tool for
  producing that consistency, but shouldn't a concensus be reached
  amongst the developers for stylistic personal preference changes as
  opposed to actual algorithmic correctness?
 
 
 I agree. But this is not *my* preference, it's EFL style as far as I
 know.  I may be wrong though.
 
 I tried to cover all the possible cases and the only exceptions were
 when it's wrong not using E [=!]= NULL. I have the patch for all the
 other libraries as well.
 
 Raster, k-s, others, what do you think? Can I apply for the other ones?
checking - this is a patch to go
  if (x == NULL) - if (!x)
right? (and the inverse).
  if (x != NULL)  - if (x)

right?

-- 
- Codito, ergo sum - I code, therefore I am --
The Rasterman (Carsten Haitzler)ras...@rasterman.com


--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] E SVN: lucas IN trunk/embryo/src: bin lib

2010-08-16 Thread Michael Jennings
On Monday, 16 August 2010, at 19:15:02 (-0300),
Lucas De Marchi wrote:

 6) i = a == NULL;= i = !a;
 7) i = a != NULL;= i = !!a;
 
 Those four are valid also for while loops.
 
Eina_Bool func(char *a)
{
 8)return a == NULL;= return !a;
 9)return a != NULL;= return !!a;
}
 
 
 int func2(Eina_Bool b) { return 0; }
 
 ...
 char *a;
 
 10) func2(a == NULL);   = func2(!a);
 11) func2(a != NULL);   = func2(!!a);

Those significantly reduce readability IMHO.

Michael

-- 
Michael Jennings (a.k.a. KainX)  http://www.kainx.org/  m...@kainx.org
Linux Server/Cluster Admin, LBL.gov   Author, Eterm (www.eterm.org)
---
 Can we leave the world outside just for awhile, just for awhile?
  Spend some time, you and I, under this bright, glorious sky?  It's
  been so long since I first saw you, but I still love the smile in
  your eyes.   -- Roxette, Church of Your Heart

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] E SVN: lucas IN trunk/embryo/src: bin lib

2010-08-16 Thread Albin Tonnerre
On Mon, 16 Aug 2010 15:22 -0700, Michael Jennings wrote :
 On Monday, 16 August 2010, at 19:15:02 (-0300),
 Lucas De Marchi wrote:
 
  6) i = a == NULL;= i = !a;
  7) i = a != NULL;= i = !!a;
  
  Those four are valid also for while loops.
  
 Eina_Bool func(char *a)
 {
  8)return a == NULL;= return !a;
  9)return a != NULL;= return !!a;
 }
  
  
  int func2(Eina_Bool b) { return 0; }
  
  ...
  char *a;
  
  10) func2(a == NULL);   = func2(!a);
  11) func2(a != NULL);   = func2(!!a);
 
 Those significantly reduce readability IMHO.

I agree with Michael here.

Cheers,
-- 
Albin Tonnerre

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] E SVN: lucas IN trunk/embryo/src: bin lib

2010-08-13 Thread Lucas De Marchi
On Thu, Aug 12, 2010 at 6:08 PM, Kim Woelders k...@woelders.dk wrote:

 If this causes trouble just forget about it. In any case, please don't
 introduce bugs :)


Kim, i've committed the change in E16. But it went with a bogus log
message. The reason why it can have false negatives is that I don't
have the following headers in my system:

kstat.h
machine/soundcard.h
dmedia/audio.h

I successfully compiled E16 with no errors or warnings.

Lucas De Marchi

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] E SVN: lucas IN trunk/embryo/src: bin lib

2010-08-13 Thread Kim Woelders
On Fri, 13 Aug 2010 19:08:46 +0200, Lucas De Marchi  
lucas.demar...@profusion.mobi wrote:

 On Thu, Aug 12, 2010 at 6:08 PM, Kim Woelders k...@woelders.dk wrote:

 If this causes trouble just forget about it. In any case, please don't
 introduce bugs :)


 Kim, i've committed the change in E16. But it went with a bogus log
 message. The reason why it can have false negatives is that I don't
 have the following headers in my system:

 kstat.h
 machine/soundcard.h
 dmedia/audio.h

 I successfully compiled E16 with no errors or warnings.

Ok, Thanks :)

/Kim

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] E SVN: lucas IN trunk/embryo/src: bin lib

2010-08-12 Thread Lucas De Marchi
On Wed, Aug 11, 2010 at 6:36 PM, Michael Jennings m...@kainx.org wrote:
 I'm all for consistency, and this is certainly a great tool for
 producing that consistency, but shouldn't a concensus be reached
 amongst the developers for stylistic personal preference changes as
 opposed to actual algorithmic correctness?


I agree. But this is not *my* preference, it's EFL style as far as I
know.  I may be wrong though.

I tried to cover all the possible cases and the only exceptions were
when it's wrong not using E [=!]= NULL. I have the patch for all the
other libraries as well.

Raster, k-s, others, what do you think? Can I apply for the other ones?



Lucas De Marchi

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] E SVN: lucas IN trunk/embryo/src: bin lib

2010-08-12 Thread Vincent Torri


On Thu, 12 Aug 2010, Lucas De Marchi wrote:

 On Wed, Aug 11, 2010 at 6:36 PM, Michael Jennings m...@kainx.org wrote:
 I'm all for consistency, and this is certainly a great tool for
 producing that consistency, but shouldn't a concensus be reached
 amongst the developers for stylistic personal preference changes as
 opposed to actual algorithmic correctness?


 I agree. But this is not *my* preference, it's EFL style as far as I
 know.  I may be wrong though.

EFL style ? Where is it described ?

Vincent

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] E SVN: lucas IN trunk/embryo/src: bin lib

2010-08-12 Thread Lucas De Marchi
On Thu, Aug 12, 2010 at 9:20 AM, Vincent Torri vto...@univ-evry.fr wrote:
 On Thu, 12 Aug 2010, Lucas De Marchi wrote:
 On Wed, Aug 11, 2010 at 6:36 PM, Michael Jennings m...@kainx.org wrote:
 EFL style ? Where is it described ?

Good time to start writing  what we know by asking each other on irc /
mailing list.


Lucas De Marchi

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] E SVN: lucas IN trunk/embryo/src: bin lib

2010-08-12 Thread Kim Woelders
On Thu, 12 Aug 2010 13:21:10 +0200, Lucas De Marchi  
lucas.demar...@profusion.mobi wrote:

 On Wed, Aug 11, 2010 at 6:36 PM, Michael Jennings m...@kainx.org wrote:
 I'm all for consistency, and this is certainly a great tool for
 producing that consistency, but shouldn't a concensus be reached
 amongst the developers for stylistic personal preference changes as
 opposed to actual algorithmic correctness?


 I agree. But this is not *my* preference, it's EFL style as far as I
 know.  I may be wrong though.

 I tried to cover all the possible cases and the only exceptions were
 when it's wrong not using E [=!]= NULL. I have the patch for all the
 other libraries as well.

 Raster, k-s, others, what do you think? Can I apply for the other ones?

I think we are in the personal taste department here, so it's probably  
dangerous just to change this all over.

As for e16 I think I changed my mind somewhere along the way in favor of  
what you suggest, so e16 is a bit messy here :)
Feel free to make these changes in the E16 subtree.

One question though - there are a lot of constructions like

   if ((p = strchr(s, ' ')) == NULL)
   return 0;

I assume this would be changed to

   if (!(p = strchr(s, ' ')))
   return 0;

which I don't like much. I'd prefer

   p = strchr(s, ' ');
   if (!p)
   return 0;

Would it be possible to teach coccinelle that? :)

/Kim

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] E SVN: lucas IN trunk/embryo/src: bin lib

2010-08-12 Thread Lucas De Marchi
On Thu, Aug 12, 2010 at 2:47 PM, Kim Woelders k...@woelders.dk wrote:
 I think we are in the personal taste department here, so it's probably
 dangerous just to change this all over.

I took embryo as the first victim because it has examples of most of
the cases. I would really like to apply the changes universally, but
once people start complaining on his project, I stop. Not forcing
anything in anyone here... I just like the idea of having a uniform
style along the entire repository. And then, once people know what the
style is, it'll be preserved :-D


 As for e16 I think I changed my mind somewhere along the way in favor of
 what you suggest, so e16 is a bit messy here :)
 Feel free to make these changes in the E16 subtree.

Good!! I think most of them are in E16 dir :-D


 One question though - there are a lot of constructions like

  if ((p = strchr(s, ' ')) == NULL)
      return 0;

 I assume this would be changed to

  if (!(p = strchr(s, ' ')))
      return 0;

As of now, yes.


 which I don't like much. I'd prefer

  p = strchr(s, ' ');
  if (!p)
      return 0;

 Would it be possible to teach coccinelle that? :)

Yes, except that for 'while', 'for' and maybe other cases it will not
work. If we do that, we'll introduce a bug. Then, what do I do? Keep
them different for if / while / for / '?' / other_conditions,
introduce a bug or just apply as is?



Lucas De Marchi

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] E SVN: lucas IN trunk/embryo/src: bin lib

2010-08-12 Thread Kim Woelders
On Thu, 12 Aug 2010 20:09:20 +0200, Lucas De Marchi  
lucas.demar...@profusion.mobi wrote:

 On Thu, Aug 12, 2010 at 2:47 PM, Kim Woelders k...@woelders.dk wrote:
 I think we are in the personal taste department here, so it's probably
 dangerous just to change this all over.

 I took embryo as the first victim because it has examples of most of
 the cases. I would really like to apply the changes universally, but
 once people start complaining on his project, I stop. Not forcing
 anything in anyone here... I just like the idea of having a uniform
 style along the entire repository. And then, once people know what the
 style is, it'll be preserved :-D


 As for e16 I think I changed my mind somewhere along the way in favor of
 what you suggest, so e16 is a bit messy here :)
 Feel free to make these changes in the E16 subtree.

 Good!! I think most of them are in E16 dir :-D


 One question though - there are a lot of constructions like

  if ((p = strchr(s, ' ')) == NULL)
  return 0;

 I assume this would be changed to

  if (!(p = strchr(s, ' ')))
  return 0;

 As of now, yes.


 which I don't like much. I'd prefer

  p = strchr(s, ' ');
  if (!p)
  return 0;

 Would it be possible to teach coccinelle that? :)

 Yes, except that for 'while', 'for' and maybe other cases it will not
 work. If we do that, we'll introduce a bug. Then, what do I do? Keep
 them different for if / while / for / '?' / other_conditions,
 introduce a bug or just apply as is?

If this causes trouble just forget about it. In any case, please don't  
introduce bugs :)

/Kim


--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


Re: [E-devel] E SVN: lucas IN trunk/embryo/src: bin lib

2010-08-11 Thread Michael Jennings
On Wednesday, 11 August 2010, at 13:35:26 (-0700),
Enlightenment SVN wrote:

 Log:
   Remove comparisons to NULL
   
   Rather than using == NULL or != NULL, use expression or !expression 
 where
   possible.
   
   Patch automatically generated by coccinelle from badnull.cocci and
   badnull2.cocci

I think it's great that such a tool exists, and what it can do is
impressive.

But in this particular case, you seem to be correcting what is
really a stylistic choice, not a programming error, and there are very
valid arguments for having explicit comparisons to NULL (or 0, for
that matter), not the least of which being explicit readability.

I'm all for consistency, and this is certainly a great tool for
producing that consistency, but shouldn't a concensus be reached
amongst the developers for stylistic personal preference changes as
opposed to actual algorithmic correctness?

Michael

-- 
Michael Jennings (a.k.a. KainX)  http://www.kainx.org/  m...@kainx.org
Linux Server/Cluster Admin, LBL.gov   Author, Eterm (www.eterm.org)
---
 Don't go making all these promises you know you cannot keep.
  There's a time to play a king and a time to be the thief.  'Cause
  if you're making all these promises you know you cannot keep, you
  know time will be the thief, and your fallen king will end up
  alone. -- Savage Garden, Promises

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel