Relative Content

Tag Archive for data-types

Knowing the range of variable types needed

So, if I (as the programmer) know that my value will never exceed a small number (say 100) because it is really just a counter-controlled loop or whatever, may I use short or char instead of int for the minute memory savings?

Knowing the range of variable types needed

So, if I (as the programmer) know that my value will never exceed a small number (say 100) because it is really just a counter-controlled loop or whatever, may I use short or char instead of int for the minute memory savings?

Do any notable C extensions include integer types whose behavior is independent of machine word size

An interesting characteristic of C compared with some other languages is that many of its data types are based upon the word size of the target architecture, rather than being specified in absolute terms. While this allows the language to be used to write code on machines that might have difficulty with certain types, it makes it very difficult to design code which will run consistently on different architectures. Consider the code:

What Scala type to use for a list of meeting participants

I want to store a number of participants for a meeting. The order of them is not important. The only thing I want to make sure is, that I will be able to add and remove participants, use filter functions (and alike) and get their number. Also duplicates are not allowed.
I started using List for the method signature, but now I wonder if I should accept a more abstract type. I saw types like Traversable, TraversableLike, Iterable and IterableLike.

What Scala type to use for a list of meeting participants

I want to store a number of participants for a meeting. The order of them is not important. The only thing I want to make sure is, that I will be able to add and remove participants, use filter functions (and alike) and get their number. Also duplicates are not allowed.
I started using List for the method signature, but now I wonder if I should accept a more abstract type. I saw types like Traversable, TraversableLike, Iterable and IterableLike.