Skip to main content
added 372 characters in body
Source Link
DoneWithThis.
  • 17.6k
  • 4
  • 42
  • 68

'type cast' is a single idea.
It's a coding/programming term meaning to specify a data type by forcing it, type-casting it - into the desired form.

For instance "3" is a 'string', which is a text data type. The quotes in programming make that quite specific; it's not a number any more, it's a string, even though the string contains what to a human looks exactly like a number. Computers don't see things the way humans do.

So - if we need to take that string & force it to become a number, we type-cast it to an integer [which is a whole number with no decimals]

Our string "3" then becomes the integer 3

in pseudo-code...

string myText = "3"; integer myNumber = (integer)myText;

That (integer) in brackets is the 'forcing', the type-cast.

Whether to hyphenate or not is probably a UK/US thing. I'm British, we hyphenate a lot more than the Americans.

I guess it could come from 'to throw' it into a particular type, but I'm not certain. To cast a spell would be a similar use - whether that's 'thrown' might be debatable.
Looking down the 10 meanings in the Oxford Dictionary for 'cast' I honestly wouldn't really know which it would fall under.
It might even be more akin to casting an object from molten metal.

'type cast' is a single idea.
It's a coding/programming term meaning to specify a data type by forcing it, type-casting it - into the desired form.

For instance "3" is a 'string', which is a text data type. The quotes in programming make that quite specific; it's not a number any more, it's a string, even though the string contains what to a human looks exactly like a number. Computers don't see things the way humans do.

So - if we need to take that string & force it to become a number, we type-cast it to an integer [which is a whole number with no decimals]

Our string "3" then becomes the integer 3

in pseudo-code...

string myText = "3"; integer myNumber = (integer)myText;

That (integer) in brackets is the 'forcing', the type-cast.

Whether to hyphenate or not is probably a UK/US thing. I'm British, we hyphenate a lot more than the Americans.

I guess it could come from 'to throw' it into a particular type, but I'm not certain. To cast a spell would be a similar use - whether that's 'thrown' might be debatable.
Looking down the 10 meanings in the Oxford Dictionary for 'cast' I honestly wouldn't really know which it would fall under.

'type cast' is a single idea.
It's a coding/programming term meaning to specify a data type by forcing it, type-casting it - into the desired form.

For instance "3" is a 'string', which is a text data type. The quotes in programming make that quite specific; it's not a number any more, it's a string, even though the string contains what to a human looks exactly like a number. Computers don't see things the way humans do.

So - if we need to take that string & force it to become a number, we type-cast it to an integer [which is a whole number with no decimals]

Our string "3" then becomes the integer 3

in pseudo-code...

string myText = "3"; integer myNumber = (integer)myText;

That (integer) in brackets is the 'forcing', the type-cast.

Whether to hyphenate or not is probably a UK/US thing. I'm British, we hyphenate a lot more than the Americans.

I guess it could come from 'to throw' it into a particular type, but I'm not certain. To cast a spell would be a similar use - whether that's 'thrown' might be debatable.
Looking down the 10 meanings in the Oxford Dictionary for 'cast' I honestly wouldn't really know which it would fall under.
It might even be more akin to casting an object from molten metal.

added 372 characters in body
Source Link
DoneWithThis.
  • 17.6k
  • 4
  • 42
  • 68

'type cast' is a single idea.
It's a coding/programming term meaning to specify a data type by forcing it, type-casting it - into the desired form.

For instance "3" is a 'string', which is a text data type. The quotes in programming make that quite specific; it's not a number any more, it's a string, even though the string contains what to a human looks exactly like a number. Computers don't see things the way humans do.

So - if we need to take that string & force it to become a number, we type-cast it to an integer [which is a whole number with no decimals]

Our string "3" then becomes the integer 3

in pseudo-code...

string myText = "3"; integer myNumber = (integer)myText;

That (integer) in brackets is the 'forcing', the type-cast.

Whether to hyphenate or not is probably a UK/US thing. I'm British, we hyphenate a lot more than the Americans.

I guess it could come from 'to throw' it into a particular type, but I'm not certain. To cast a spell would be a similar use - whether that's 'thrown' might be debatable.
Looking down the 10 meanings in the Oxford Dictionary for 'cast' I honestly wouldn't really know which it would fall under.

'type cast' is a single idea.
It's a coding/programming term meaning to specify a data type by forcing it, type-casting it - into the desired form.

For instance "3" is a 'string', which is a text data type. The quotes in programming make that quite specific; it's not a number any more, it's a string, even though the string contains what to a human looks exactly like a number. Computers don't see things the way humans do.

So - if we need to take that string & force it to become a number, we type-cast it to an integer [which is a whole number with no decimals]

Our string "3" then becomes the integer 3

in pseudo-code...

string myText = "3"; integer myNumber = (integer)myText;

That (integer) in brackets is the 'forcing', the type-cast.

Whether to hyphenate or not is probably a UK/US thing. I'm British, we hyphenate a lot more than the Americans.

'type cast' is a single idea.
It's a coding/programming term meaning to specify a data type by forcing it, type-casting it - into the desired form.

For instance "3" is a 'string', which is a text data type. The quotes in programming make that quite specific; it's not a number any more, it's a string, even though the string contains what to a human looks exactly like a number. Computers don't see things the way humans do.

So - if we need to take that string & force it to become a number, we type-cast it to an integer [which is a whole number with no decimals]

Our string "3" then becomes the integer 3

in pseudo-code...

string myText = "3"; integer myNumber = (integer)myText;

That (integer) in brackets is the 'forcing', the type-cast.

Whether to hyphenate or not is probably a UK/US thing. I'm British, we hyphenate a lot more than the Americans.

I guess it could come from 'to throw' it into a particular type, but I'm not certain. To cast a spell would be a similar use - whether that's 'thrown' might be debatable.
Looking down the 10 meanings in the Oxford Dictionary for 'cast' I honestly wouldn't really know which it would fall under.

Source Link
DoneWithThis.
  • 17.6k
  • 4
  • 42
  • 68

'type cast' is a single idea.
It's a coding/programming term meaning to specify a data type by forcing it, type-casting it - into the desired form.

For instance "3" is a 'string', which is a text data type. The quotes in programming make that quite specific; it's not a number any more, it's a string, even though the string contains what to a human looks exactly like a number. Computers don't see things the way humans do.

So - if we need to take that string & force it to become a number, we type-cast it to an integer [which is a whole number with no decimals]

Our string "3" then becomes the integer 3

in pseudo-code...

string myText = "3"; integer myNumber = (integer)myText;

That (integer) in brackets is the 'forcing', the type-cast.

Whether to hyphenate or not is probably a UK/US thing. I'm British, we hyphenate a lot more than the Americans.