Word name clashes with C types
Factor handbook » C library interface » Passing data between Factor and C » C type specifiers

Prev:Pointer and array types
Next:Struct and union types


Note that some of the C type word names clash with commonly-used Factor words:
float clashes with the float word in the math vocabulary

If you use the wrong vocabulary, you will see a no-c-type error. For example, the following is not valid, and will raise an error because the float word from the math vocabulary is not a C type:
USING: alien.syntax math prettyprint ; FUNCTION: float magic_number ( ) magic_number 3.0 + .

The following won't work either; now the problem is that there are two vocabularies in the search path that define a word named float:
USING: alien.c-types alien.syntax math prettyprint ; FUNCTION: float magic_number ( ) magic_number 3.0 + .

The correct solution is to use one of FROM:, QUALIFIED: or QUALIFIED-WITH: to disambiguate word lookup:
USING: alien.syntax math prettyprint ; QUALIFIED-WITH: alien.c-types c FUNCTION: c:float magic_number ( ) magic_number 3.0 + .

See Resolution of ambiguous word names for details.