sane-project-website/old-archive/1998-07/0031.html

78 wiersze
3.8 KiB
HTML

<!-- received="Fri Jul 10 15:51:50 1998 PDT" -->
<!-- sent="Fri, 10 Jul 1998 10:18:01 +0100 (BST)" -->
<!-- name="Ian Grant" -->
<!-- email="I.A.N.Grant@damtp.cam.ac.uk" -->
<!-- subject="Re: Epson backend" -->
<!-- id="Pine.OSF.3.96.980710100230.1758B-100000@quark.amtp.cam.ac.uk" -->
<!-- inreplyto="35A360E5.99C9E96B@navd.alcatel.de" -->
<title>sane-devel: Re: Epson backend</title>
<h1>Re: Epson backend</h1>
<b>Ian Grant</b> (<a href="mailto:I.A.N.Grant@damtp.cam.ac.uk"><i>I.A.N.Grant@damtp.cam.ac.uk</i></a>)<br>
<i>Fri, 10 Jul 1998 10:18:01 +0100 (BST)</i>
<p>
<ul>
<li> <b>Messages sorted by:</b> <a href="date.html#31">[ date ]</a><a href="index.html#31">[ thread ]</a><a href="subject.html#31">[ subject ]</a><a href="author.html#31">[ author ]</a>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0032.html">Hugo van der Kooij: "Re: Installing SANE on DU machines"</a>
<li> <b>Previous message:</b> <a href="0030.html">Ian Grant: "Installing SANE on DU machines"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>
<!-- body="start" -->
On Wed, 8 Jul 1998, Christian Bucher wrote:<br>
<p>
<i>&gt; Ian Grant wrote:</i><br>
<i>&gt; &gt; </i><br>
<i>&gt; &gt; Oops! Sorry, I didn't think much before I did that, did I? This structure</i><br>
<i>&gt; &gt; is just the header for something of variable length. This (array[0]) is</i><br>
<i>&gt; &gt; ANSI C isn't it?</i><br>
<i>&gt; </i><br>
<i>&gt; Bingo. Not shure about the ANSI C. But there is no other way to do it</i><br>
<i>&gt; (also not [1], will confuse sizeof).</i><br>
<p>
I've checked and (a) It's not ANSI, at least not according to the version<br>
of the draft published with my white book ("the array length must a be a<br>
constant greater than 0"), and (b) there is certainly another way to do<br>
this, possibly more than one. For example, since you're relying on the<br>
pack pragma anyway, you can have the array with [1] but correct for it<br>
whenever you take the sizeof(struct) by going sizeof(struct) -<br>
sizeof(uchar). Then, as long you're careful not to dereference the array<br>
without checking the size in the header structure it's safe. Alternatively<br>
you could use uchar *buf = (uchar *) (&amp;struct + 1); instead of having the<br>
buf variable as part of the header structure. <br>
<p>
<i>&gt; &gt; It would be bad news if we had to use gcc, because there's X stuff in</i><br>
<i>&gt; &gt; this build and mixing compilers (our X is compiled with Digital cc) can be</i><br>
<i>&gt; &gt; trouble. So I'll try and find a compatibility switch first.</i><br>
<i>&gt; </i><br>
<i>&gt; Mixing compilers should no problem as long it's C and not C++.</i><br>
<p>
epson.c is the only piece of code in SANE that doesn't build with<br>
Digital's cc. Also, the whole of gtk and gimp builds with digital's cc<br>
(except for one line in one plugin which the author is very embarassed<br>
about.) Also, SANE used to build with digital's cc. I think you need a<br>
much better argument to leave in code that breaks the build with other<br>
compilers. (Remember gcc is not always the fastest, most efficient<br>
compiler on modern architectures like Alpha and Pentium.)<br>
<p>
I would like to try and fix this. If I send you another patch (I promise<br>
to be more careful than last time!) will you test it?<br>
<p>
Ian<br>
<p>
<p>
<pre>
--
Source code, list archive, and docs: <a href="http://www.mostang.com/sane/">http://www.mostang.com/sane/</a>
To unsubscribe: echo unsubscribe sane-devel | mail <a href="mailto:majordomo@mostang.com">majordomo@mostang.com</a>
</pre>
<!-- body="end" -->
<p>
<ul>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0032.html">Hugo van der Kooij: "Re: Installing SANE on DU machines"</a>
<li> <b>Previous message:</b> <a href="0030.html">Ian Grant: "Installing SANE on DU machines"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>