INTL 3:770/1 3:770/3   
   REPLYADDR invalid@invalid.invalid   
   REPLYTO 3:770/3.0 UUCP   
   MSGID: 92cf5137   
   REPLY: <20240829140519.0f9feb077b892bb9521f06c6@eircom.net> 266c13f1   
   PID: SoupGate-Win32 v1.05   
   Ahem A Rivet's Shot writes:   
   > Richard Kettlewell wrote:   
   >> Ahem A Rivet's Shot writes:   
   >>> There are always the int_t types for when size matters.   
   >>   
   >> Life is not always that simple and declaring how things ‘should’ be   
   >> does not fix a single line of code.   
   >   
   > Very true - horse, water, drink.   
   >   
   >> One of the public APIs we support largely uses ‘long’ and ‘unsigned   
   >> long’ for integral values, which causes occasional issues with our   
   >> cross-platform code. For example ‘unsigned long’ has the same size as   
   >> ‘size_t’ on Linux, but not on 64-bit Windows.   
   >   
   > Which is why putting assigning the value of a size_t to an unsigned   
   > long or vice-versa is wrong.   
      
   No, it’s not necessarily wrong. If the value fits in the destination   
   type there’s nothing wrong with it. The results are well-defined and do   
   not change the value. You can look up the rules in the C standard.   
      
   The common case (for users of this API) is passing the size of a   
   relatively small object, of fixed size. There is no practical issue   
   there. The less common case is where the value is unknown at compile   
   time, meaning an extra check and an explicit conversion are needed. It’s   
   not remotely difficult to deal with, it’s just an annoyance (as I   
   previously wrote).   
      
   --   
   https://www.greenend.org.uk/rjk/   
      
   --- SoupGate-Win32 v1.05   
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)   
   SEEN-BY: 10/0 1 90/1 103/705 105/81 106/201 124/5016 129/305 153/757   
   SEEN-BY: 153/7715 218/0 1 601 700 840 870 930 220/70 221/1 6 360 226/17   
   SEEN-BY: 226/30 100 227/114 229/110 111 114 200 206 300 317 400 426   
   SEEN-BY: 229/428 470 550 616 664 700 240/1120 266/512 267/800 282/1038   
   SEEN-BY: 291/111 292/854 301/1 113 812 310/31 320/219 322/757 335/364   
   SEEN-BY: 341/66 342/200 396/45 460/58 633/280 712/848 770/1 3 100   
   SEEN-BY: 770/330 340 772/210 220 230 5020/400 1042 5058/104 5075/35   
   PATH: 770/3 1 218/840 221/6 301/1 218/700 229/426   
      
|