From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.236.26.206 with SMTP id c54mr617682yha.44.1406693472325; Tue, 29 Jul 2014 21:11:12 -0700 (PDT) X-Received: by 10.182.61.9 with SMTP id l9mr6224obr.1.1406693472033; Tue, 29 Jul 2014 21:11:12 -0700 (PDT) Path: border1.nntp.dca1.giganews.com!nntp.giganews.com!v10no3335744qac.1!news-out.google.com!px9ni0igc.0!nntp.google.com!h18no10248266igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 29 Jul 2014 21:11:11 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.57.209.48; posting-account=zwxLlwoAAAChLBU7oraRzNDnqQYkYbpo NNTP-Posting-Host: 173.57.209.48 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: What is a byte? From: "Dan'l Miller" Injection-Date: Wed, 30 Jul 2014 04:11:12 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: number.nntp.dca.giganews.com comp.lang.ada:188041 Date: 2014-07-29T21:11:11-07:00 List-Id: On Tuesday, July 29, 2014 1:40:56 PM UTC-5, Simon Wright wrote: > "Dan'l Miller" writes: > If the C function takes a char, you should specify > Interfaces.C.char. As far as the actual invocation of C-library function by Victor's Ada cod= e, I agree. But that is only a portion of Victor's situation: 1) A C library may pass char back to Victor's Ada code via return values, o= ut-bound char* parameters, and as in-bound parameters on a call-back functi= on. 2) Victor's Ada code needs to store that char somehow. He could have a thi= n binding and store these in-coming (typically-8-bit) values always as Inte= rfaces.C.char or aliases thereof. Or he could narrow to Ada ranged subtype= s if handling the beyond-8-bit cases throughout his code becomes unwieldy. = It is this simplification of his Ada code to the octet meaning to which I = was referring. > It's up to the compiler to decide whether that gets > passed in 8 bits, 32 bits, or come to that 9/36 bits on hardware that no > one is remotely likely to encounter (even in an arcade). Focusing solely on out-going values to char, I agree. But it is up to Vict= or as a human-being to decide how much pain to incur at Ada-code design-tim= e to handle the beyond-8-bit varieties of byte on arcane ISAs for in-coming= chars. Most programmers have little patience to pursue oddball definition= s of byte for the non-octet cases. Lack of patience typically implies a gr= eater quantity of bugs for nonoctet bytes. It was this latter effort-reduc= tion to which I was referring.