A few holes (imho) in the ecosystem of libraries
Guillaume Piolat
first.last at spam.org
Mon May 15 14:33:44 UTC 2023
On Monday, 15 May 2023 at 14:04:39 UTC, Andrew wrote:
>
> ```d
> bool getImageInfo(S)(S* stream) if (isByteInputStream!S)
> {
> ubyte[3] buf;
> int bytes = stream.read(buf[]);
> if (bytes != 3) return false;
> _dataOffset = buf[0];
> _cmapType = buf[1];
> _imageType = buf[2];
> return true;
> }
> ```
- I was using ranges for parsing initially but realized all my
ranges were instantiated with ubyte at one point.
- you propose the fread interface (return numbner of read
elements), I've tried that in the image library and it's not as
nice as just returning a default value, such as zero on failure,
and fail out of band.
More information about the Digitalmars-d
mailing list