> An option value always takes two words: one for the header, and then either a pointer or a word that means "None". No. From the reference manual § 19.3.4 : type 'a option = None (* Val_int(0), i.e. just an integer value = 1 word *) | Some of 'a (* block of size 1 = [(header = 1 word) + (1 field = 1 word)] = 2 words *) 2014/1/17 David House > It behaves identically to that type. > > It is just like any other sum type. However, due to the way that sum types > are represented in memory, it is not that inefficient. The only thing that > makes it less efficient than a C pointer is the header block (necessary for > the GC). An option value always takes two words: one for the header, and > then either a pointer or a word that means "None". > > > On 17 January 2014 07:35, Damien Guichard wrote: > >> Hello, >> >> Compared to the code : >> >> type 'a option = None | Some of 'a >> >> How do an 'a option value performs ? >> Any allocation saved ? >> Any indirection removed ? >> >> Is 'a option just like any sum type ? >> Or is 'a option more like an ANSI C pointer type ? >> >> Regards, >> >> Damien Guichard >> >> >> >> -- >> Caml-list mailing list. Subscription management and archives: >> https://sympa.inria.fr/sympa/arc/caml-list >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> Bug reports: http://caml.inria.fr/bin/caml-bugs >> > >