Re: CVS domivogt: * Removed ifdefs from fifos.c.

2006-07-13 Thread Dominik Vogt
On Thu, Jul 13, 2006 at 11:01:13AM +0200, Viktor Griph wrote:
> On Thu, 13 Jul 2006, Dominik Vogt wrote:
> >>Is it really neccessary to defene everything with FVWM_ as a prefix? If
> >>it's not already defined, why not define it using the expected name?
> >
> >I use the "fvwm" prefix to document that we modified its meaning.
> >If we had just
> >
> > #define O_NOFOLLOW 0
> >
> >someone might rely ona that flag although it's just a dummy to
> >make the compiler happy.
> >
> 
> Well, you didn't define it FVWM_O_NOFOLLOW in configure.ac, so it's just 
> O_NOFOLLOW in there as well. It was all the stat-wrappers that I was 
> concerned about. The code use many of them unwrapped already, so if there 
> is a chance that some of them might not be defined it would be better to 
> provide them, with the assumed values you did, under the name expected by 
> the programmer.

There's really no final word on how to handle portability issues
yet.  For maintenance reasons, we need to avoid ifdef'ed code as
much as possible.  If we can't cope without ifdefs in some place,
they should be only in a single wrapper file (libs/FShape.h is an
example).  Ifdefs in the code can easily be replaced with
constructs like this.

in .c file:

  #ifdef FOOBAR
some(code);
  #endif

becomes:

in some .h file:

  #ifdef FOOBAR
  #  define USE_FOOBAR 1
  #else
  #  define USE_FOOBAR 0
  #endif

and in the .c file:

  if (USE_FOOBAR)
  {
some(code);
  }

A big advantage is that *all* code is compiled, regardless of the
platform's features.  The compiler should be smart enough to
optimise code like "if (0) some(code);".

The latest way to go is to provide dummy functionality that
satisfies the original interfaces and put it in "if (0)" when it's
not used.

Ciao

Dominik ^_^  ^_^

 --
Dominik Vogt, [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: CVS domivogt: * Removed ifdefs from fifos.c.

2006-07-13 Thread Viktor Griph

On Thu, 13 Jul 2006, Dominik Vogt wrote:


On Thu, Jul 13, 2006 at 09:16:24AM +0200, Viktor Griph wrote:

On Wed, 12 Jul 2006, FVWM CVS wrote:


Log message:
* Removed ifdefs from fifos.c.
* Added a compat header file libs/fvwm_sys_stat.h to wrap stat.h compat
 issues.




Is it really neccessary to defene everything with FVWM_ as a prefix? If
it's not already defined, why not define it using the expected name?


I use the "fvwm" prefix to document that we modified its meaning.
If we had just

 #define O_NOFOLLOW 0

someone might rely ona that flag although it's just a dummy to
make the compiler happy.



Well, you didn't define it FVWM_O_NOFOLLOW in configure.ac, so it's just 
O_NOFOLLOW in there as well. It was all the stat-wrappers that I was 
concerned about. The code use many of them unwrapped already, so if there 
is a chance that some of them might not be defined it would be better to 
provide them, with the assumed values you did, under the name expected by 
the programmer.


/Viktor



Re: CVS domivogt: * Removed ifdefs from fifos.c.

2006-07-13 Thread Dominik Vogt
On Thu, Jul 13, 2006 at 09:16:24AM +0200, Viktor Griph wrote:
> On Wed, 12 Jul 2006, FVWM CVS wrote:
> 
> >Log message:
> >* Removed ifdefs from fifos.c.
> >* Added a compat header file libs/fvwm_sys_stat.h to wrap stat.h compat
> >  issues.
> >
> >
> 
> Is it really neccessary to defene everything with FVWM_ as a prefix? If 
> it's not already defined, why not define it using the expected name?

I use the "fvwm" prefix to document that we modified its meaning.
If we had just

  #define O_NOFOLLOW 0

someone might rely ona that flag although it's just a dummy to
make the compiler happy.

Ciao

Dominik ^_^  ^_^

 --
Dominik Vogt, [EMAIL PROTECTED]


signature.asc
Description: Digital signature


Re: CVS domivogt: * Removed ifdefs from fifos.c.

2006-07-13 Thread Viktor Griph

On Wed, 12 Jul 2006, FVWM CVS wrote:


Log message:
* Removed ifdefs from fifos.c.
* Added a compat header file libs/fvwm_sys_stat.h to wrap stat.h compat
  issues.




Is it really neccessary to defene everything with FVWM_ as a prefix? If 
it's not already defined, why not define it using the expected name?


/Viktor



Re: CVS domivogt: * Removed ifdefs from fifos.c.

2006-07-12 Thread Thomas Adam
On Wed, Jul 12, 2006 at 03:27:26AM -0500, FVWM CVS wrote:
> CVSROOT:  /home/cvs/fvwm
> Module name: fvwm Changes by: domivogt 06/07/12 03:27:26
>
> Modified files: . : ChangeLog configure.ac libs : Makefile.am modules
> : ChangeLog modules/FvwmCommand: FvwmCommand.h fifos.c
>
> Log message: * Removed ifdefs from fifos.c. * Added a compat header
> file libs/fvwm_sys_stat.h to wrap stat.h compat issues.

Might I suggest the #ifdefs reasoning is added to docs/CONVENTIONS ?  I
think it would be useful there.

-- Thomas Adam

-- 
"If I were a witch's hat, sitting on her head like a paraffin stove, I'd
fly away and be a bat." -- Incredible String Band.



CVS domivogt: * Removed ifdefs from fifos.c.

2006-07-12 Thread FVWM CVS
CVSROOT:/home/cvs/fvwm
Module name:fvwm
Changes by: domivogt06/07/12 03:27:26

Modified files:
.  : ChangeLog configure.ac 
libs   : Makefile.am 
modules: ChangeLog 
modules/FvwmCommand: FvwmCommand.h fifos.c 

Log message:
* Removed ifdefs from fifos.c.
* Added a compat header file libs/fvwm_sys_stat.h to wrap stat.h compat issues.