Tag Info

New answers tagged

1

C++ treats int, const int, int&, and const int& as separate types with ways to convert to/from each type (except to const int or to const int&). If you know what types you have and what types are expected, then given a list of converters, you know if you can make each passed parameter pass as an argument parameter. Since there may also be ...


1

Ceylon has full support for first-class union and intersection types. You write a union type as X | Y and an intersection type as X & Y. Even better, Ceylon features a lot of sophisticated reasoning about these types, including: principal instantiations: for example, Consumer<X>&Consumer<Y> is the same type as Consumer<X|Y> if ...


0

I have decided to go through with this design decision for the following reasons: Such a convention is actually more consistent with the functional nature of the language. All functions are unary (accept a single argument) -- those accepting multiple arguments are simply curried, and those accepting "none" (as per this decision) actually accept the sole () ...


4

Sure, that makes sense theoretically. Especially in functional languages, having a function that takes no input is weird. Though I would encourage you to prevent declaring parameterless functions, not prevent them in your type system. Consider parameter binding. If you have a unary function and bind a parameter to it, you would have a parameterless function ...


2

Scala returning () really just means that you should ignore the meaningless return value. Basically the same as void in C, right? But a function that takes no arguments can still return a usable value, so I'm not sure I see a one-to-one correspondence in the design. Forcing functionally parameterless functions to take a parameter of type Unit which is ...


2

Because all identifiers ending with _t are reserved for future additional types. The int32_t family of types was added in the C99 standard, so they used the reserved names to avoid conflict with already existing software. You can find a nice overview of reserved names in the glibc documentation. Note: Since Microsoft is not the C standards committee, ...


0

size_t is read as 'size type' _t usually means type, and sometimes typedef. Why wasn't the type just called int32 So it could be distinguished from a built in type, stdint.h is supposed to choose the proper built in type to be the given size depending on the platform. N.b. some compilers int32_t aliases a compiler specific notation like i_32 or ...


3

The _t data types are typedef types in the stdint.h header, while int is a built-in fundamental data type to C. The _t datatypes are only available if stdint.h exists. The fundamental data types like int, however, are guaranteed to exist. Basically, it really doesn't mean much of anything. It's just how C decided to name things.



Top 50 recent answers are included