从-C-转向-Tea

优质
小牛编辑
120浏览
2023-12-01

下表列出了关键的区别

#include <stdio.h>              ->         import cstdlib.stdio; 
#define A 1                     ->         const A = 1
#define W(cond) while(cond)     ->         (不支持)

char                            ->         AnsiChar
_wchar                          ->         char
unsigned int                    ->         UInt
long long                       ->         long
unsigned long long              ->         ULong
void (*)(int)                   ->         Func<void, int>
const int                       ->         (不支持)
extern int                      ->         (不支持)
register int                    ->         (不支持)

int *a, *b;                     ->         int* a, b;
A: goto *&A                     ->         (不支持)
void (*a)(int) = _fn            ->         Func<void, int> a = _fn;
int a[] = {1, 3};               ->         int[] a = [1, 3];
int a[999];                     ->         int[] a = new int[999];

struct A* a; a->value           ->         A* a; (*a).value
struct C b; b.value             ->         C b = new C(); b.value

void fn(); // 函数声明          ->         (不支持)
&fn // 获取函数地址             ->         fn

a | b                           ->         a ^| b // 其它同理
(int)a                          ->         a as int 或 int(a)
(a & b) == 0                    ->         a ^& b == 0 // == 优先级高