Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001750OCamlCamlIDLpublic2003-07-12 00:362004-07-08 12:09
Reporteradministrator 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0001750: CamlIDL: signed chars break Ocaml typesystem
DescriptionHere is an example:

signed char get0x80()
quote(call,"_res = '\x80';");

it compiles to

external get0x80 : unit -> char
    = "camlidl_signed_char_get0x80"

and

value camlidl_signed_char_get0x80(value _unit)
{
  signed char _res;
  value _vres;

  /* begin user-supplied calling sequence */
_res = '\x80';
  /* end user-supplied calling sequence */
  _vres = Val_int(_res);
  return _vres;
}

but (int)((signed char)'\x80') == -1! There is no such char value in
Ocaml (its chars are unsigned) so we are obviously in trouble.

Even worse, many compilers (including GCC and MSVC) assume that char is
signed by default so writing "char get0x80() ..." we will have just the
same problems.

What I propose: traslate "char" IDL type to "unsigned char" C type (as MIDL
compiler does) and prohibit using "signed char" IDL type (or at least
generate a warning)

- Dmitry Bely


TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0000091)
administrator (administrator)
2004-07-08 12:09

Fixed conversion C -> ML for "char" and "signed char" to force unsigned
interpretation. 2004-07-08, XL

- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker