dataType
理解C++中引用的底层实现s # Type Safety in Programming Languages # Statically v. dynamically v. strongly v. weakly typed languages # Elixir in the Type System Quadrant
# Typing: dynamic vs. static and weak vs. strong—Programming fundamentals
what
b = 100
-
value Type: store Direct value; a = b; a ddress-> [100]
-
reference Type: store Indirect value: address, offset…; a = b; a address-> [b address]
question:
-
reference type vs pointer type; reference type have many forms;reference type = {pointer Type, reference type}
- pointer type(): unconst pointr
1var q = &a;- reference type(hidden pointer):
1let b = {a:1} -
pointer address and dereference;
- address(取址): &a, get variable address;
- derefernece: visit variable address *a;
c++ reference type
-
code
1 2 3int i=5; int &ri=i; ri=81 2 3int i = 5; int const *ri = &i; *ri=8 -
reference vs pointer
- reference is const pointer;
- reference Auto addressed and dereferencing;
how
type safety
type check:
- the variables match the expected type, if not throw error or ingore
- using the right ingredient when cooking
static/ dymamic : compile time/static time check type
dymanic type
- can change type
- don’t need declare the type

weak/strong type: 多大程度实施它的type system
weak: 淡化 type system, 允许implicit conversion strong: 遵循type system, 不允许implicit conversion, throw type error if not saftish the operaiton;
- 不符合类型的操作 throw type error
strong type = type safety
type error exmaple:
|
|
why type safety is important: avoid unexpected result (bug)
why c is weak type: allow implicit conversation
|
|

type safety data foramt:
在通信的不同进程中,数据的类型是一致的,与schema定义类型一样