Question: I have the below simple program:

```
#include <iostream>
#include <stdio.h>

void SomeFunction(int a)
{
  std::cout<<"Value in function: a = "<<a<<std::endl;
}

int main(){

  size_t a(0);

  std::cout<<"Value in main: "<<a-1<<std::endl;
  SomeFunction(a-1);

  return 0;

}

```

Upon executing this I get:

> 
> Value in main: 18446744073709551615
> 
> 
> Value in function: a = -1
> 
> 
> 

I think I roughly understand why the function gets the 'correct' value of -1: there is an implicit conversion from the unsigned type to the signed one i.e. 18446744073709551615(unsigned) = -1(signed).

Is there any situation where the function will not get the 'correct' value?

Answer: 
Since `size_t` type is unsigned, subtracting `1` is well defined:

> 
> A computation involving `unsigned` operands can never overflow, because a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest value that can be represented by the resulting type.
> 
> 
> 

However, the resultant value of 264-1 is out of `int`s range, so you get implementation-defined behavior:

> 
> [when] the new type is signed and the value cannot be represented in it, either the result is implementation-defined or an implementation-defined signal is raised.
> 
> 
> 

Therefore, the answer to your question is "yes": there are platforms where the value of `a` would be different; there are also platforms where instead of calling `SomeFunction` the program will raise a signal.
It's easier to compare and contrast `signed` and `insigned` of type same basic type, say `signed int` and `unsigned int`.

On a system that uses 32 bits for `int`, the range of `unsigned int` is [`0` - `4294967295`] and the range of `signed int` is [`-2147483647` - `2147483647`].

Say you have a variable of type `unsigned int` and its value is greater than `2147483647`. If you pass such a variable to `SomeFunction`, you will see an incorrect value in the function.

Conversely, say you have a variable of type `signed int` and its value is less than zero. If you pass such a variable to a function that expects an `unsigned int`, you will see an incorrect value in the function.