From: Ian S. <ian...@st...> - 2002-10-04 08:17:37
|
OK, There appears to be some disquiet about getting rid of vxl_.?int_8 and vxl_sint_.+, so I will not get rid of anything, and later today just add vxl_byte, and vxl_sbyte to vxl_config. If someone else wants to argue for getting rid of vxl_.?int_8 or vxl_sint_.+, then we (Manchester University) would be happy for them to do so. Ian. > -----Original Message----- > From: Frederik Schaffalitzky [mailto:fs...@sy...] > Sent: Friday, October 04, 2002 2:16 AM > To: Ian Scott > Cc: Vxl-maintainers (E-mail) > Subject: RE: [Vxl-maintainers] changes to explicitly sized > integer types > in vxl_config.h > > > On Thu, 3 Oct 2002, Ian Scott wrote: > > > add vxl_byte: > > typedeffed to unsigned char 8-bit char platforms. > > vil2 will use this instead of vil2_byte. > > > > add vxl_sbyte: > > typedeffed to signed char 8-bit char platforms. > > Sure, why not. That would be handy. > > > > deprecate vxl_int_8, vxl_sint_8, vxl_uint_8: > > (As Peter pointed out) these are normally defined > > to be char so > > vcl_cout << (vxl_int_8)(65) << vcl_endl; > > displays 'A' not 65. This is not int behaviour. > > I also prefer vxl_byte over vxl_uint_8, and for > > consistency vxl_sbyte over vxl_int_8. > > The vxl_*_* typedefs denote machine words of various sizes. > To call 8-bit > words "bytes" may be helpful at times but it is an inconsistent naming > scheme. One way in which a consistent naming is useful is that the > typedefs can then be used in macros. For a contrived example: > #define macro(n) \ > do { \ > std::cout << "trying " << n << "-bit integers" << std::endl; \ > typedef vxl_int_##n> int_type; \ > ... etc ... > } while (false) > > Then one can do > macro(8); > macro(16); > macro(32); > etc. This would not work if the 8-bit versions are renamed to "byte". > > Macros are also the reason why having "uint" and "sint" is > useful. E.g. > #define macro(z, n) \ > do { \ > typedef vxl_##z##int_##8 type; \ > std::vector<type> values; \ > ... etc ... > } while(false) > > which can used as in > // implement signed case > macro(s, 8); > macro(s, 16); > macro(s, 32); > // implement unsigned case > macro(u, 8); > macro(u, 16); > macro(u, 32); > > My point is that having consistently and explicitly named > typedefs around > can be useful. That does not preclude having, also useful, typedefs > typedef vxl_uint_8 vxl_byte; // assume unsigned > and > typedef vxl_int_8 vxl_sint_8; > typedef vxl_int_16 vxl_sint_16; > typedef vxl_int_32 vxl_sint_32; > for those who prefer to not see the "s"s but to eliminate the > other ones > altogether seems a bit pedantic, and not useful in any way. > > Why not just add some more typedefs but leave the existing > ones as they > are? Why must the existing ones be eliminated? > |