Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000892OCamlCamlIDLpublic2002-02-14 14:142002-04-22 11:03
Assigned To 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000892: camlidl: some "const" quirks

typedef [ref,string] char* String;
void f1(const String s); // OK
const String f2(); // line 3, column 15: syntax error

"const" is accepted in paramater definition, but not in the returned type
one. Is this intentional?


typedef [ref,string] char* String;
void f1(const String s);

produces a .c file that compiles with warnings:

void camlidl_ml2c_const2_String(value _v1, String * _c2, camlidl_ctx _ctx)
(*_c2) = camlidl_malloc_string(_v1, _ctx);
value camlidl_const2_f1(
    value _v_s)
        We will fill "s" later so it should not be const!
  String const s; /*in*/
  struct camlidl_ctx_struct _ctxs = { CAMLIDL_TRANSIENT, NULL };
  camlidl_ctx _ctx = &_ctxs;
        const2.c(36) : warning C4090: 'function' : different 'const' qualifiers
        const2.c(36) : warning C4024: 'camlidl_ml2c_const2_String' :
                       different types for formal and actual parameter 2
  camlidl_ml2c_const2_String(_v_s, &s, _ctx);
  return Val_unit;

It may even lead to error (not warning) as in the following case (it makes
not much sense, just demonstrates the problem):

void f(const int i);
value camlidl_const3_f(
    value _v_i)
  int const i; /*in*/
        const3.c(22) : error C2166: l-value specifies const object
  i = Int_val(_v_i);
  return Val_unit;

Not that I cannot live with it, but ...

Hope to hear from you soon,

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
administrator (administrator)
2002-04-22 11:03

Problem 1: ambiguity in Yacc grammar, no solution yet. Problem 2: strip const
qualifiers on local variables (2002-04-22, 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