# Re: Epson backend

Ian Grant (I.A.N.Grant@damtp.cam.ac.uk)
Fri, 10 Jul 1998 10:18:01 +0100 (BST)

- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
- Next message: Hugo van der Kooij: "Re: Installing SANE on DU machines"
- Previous message: Ian Grant: "Installing SANE on DU machines"

On Wed, 8 Jul 1998, Christian Bucher wrote:

> Ian Grant wrote:
> >
> > Oops! Sorry, I didn't think much before I did that, did I? This structure
> > is just the header for something of variable length. This (array[0]) is
> > ANSI C isn't it?
>
> Bingo. Not shure about the ANSI C. But there is no other way to do it
> (also not [1], will confuse sizeof).

I've checked and (a) It's not ANSI, at least not according to the version
of the draft published with my white book ("the array length must a be a
constant greater than 0"), and (b) there is certainly another way to do
this, possibly more than one. For example, since you're relying on the
pack pragma anyway, you can have the array with [1] but correct for it
whenever you take the sizeof(struct) by going sizeof(struct) -
sizeof(uchar). Then, as long you're careful not to dereference the array
without checking the size in the header structure it's safe. Alternatively
you could use uchar *buf = (uchar *) (&struct + 1); instead of having the
buf variable as part of the header structure.

> > It would be bad news if we had to use gcc, because there's X stuff in
> > this build and mixing compilers (our X is compiled with Digital cc) can be
> > trouble. So I'll try and find a compatibility switch first.
>
> Mixing compilers should no problem as long it's C and not C++.

epson.c is the only piece of code in SANE that doesn't build with
Digital's cc. Also, the whole of gtk and gimp builds with digital's cc
(except for one line in one plugin which the author is very embarassed
about.) Also, SANE used to build with digital's cc. I think you need a
much better argument to leave in code that breaks the build with other
compilers. (Remember gcc is not always the fastest, most efficient
compiler on modern architectures like Alpha and Pentium.)

I would like to try and fix this. If I send you another patch (I promise
to be more careful than last time!) will you test it?

Ian

    --
    Source code, list archive, and docs: http://www.mostang.com/sane/
    To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com

- Next message: Hugo van der Kooij: "Re: Installing SANE on DU machines"
- Previous message: Ian Grant: "Installing SANE on DU machines"