mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-30 09:25:26 +01:00
Added support for `short`/`int16_t`. Both function parameters and return
values this type will be supported.
Demo:
```c++
// hello_short.h
#include <cstdint>
auto foo_short(int16_t a) -> int16_t;
```
```c++
// hello_short.cpp
#include "hello_short.h"
#include <cstdio>
auto foo_short(int16_t a) -> int16_t {
printf("a = %i \n", a);
return a;
}
```
```c++
// main.carbon
library "Main";
import Cpp library "hello_short.h";
import Core library "io";
fn Run() -> i32 {
var a: i16 = 3;
Cpp.foo_short(a);
return 0;
}
```
```
$ clang -c hello_short.cpp
$ bazel-bin/toolchain/carbon compile main.carbon
$ bazel-bin/toolchain/carbon link hello_short.o main.o --output=demo
$ ./demo
a = 3
```
Part of #5263