小编Has*_*aan的帖子

char* 和 unsigned char* 之间不兼容?

以下代码行会在 HP-UX 的 C++ 编译器中生成编译器警告:

strcpy(var, "string")
Run Code Online (Sandbox Code Playgroud)

输出:

error #2167: argument of type "unsigned char *" 
    is incompatible with parameter of type "char *"
Run Code Online (Sandbox Code Playgroud)

请注意:varunsigned char *这里 - 它的数据类型超出了我的控制范围。

两个问题:

  1. 在这两种类型的上下文中,不兼容是什么意思?如果编译器被迫接受转换会发生什么?一个例子将不胜感激。
  2. 假设我必须使用,什么是使上述代码行工作的安全方法strcpy

c++ casting char-pointer

5
推荐指数
1
解决办法
1858
查看次数

Verilog中的模块:输出reg vs assign reg to wire output

让我们说它module_aregister_a,它需要链接到module_b.应register_a单独声明并分配给以下输出module_a:

reg register_a;
assign output_a = register_a;
Run Code Online (Sandbox Code Playgroud)

还是应该只宣布output_areg在模块声明内联和使用的代码?

verilog hdl

1
推荐指数
1
解决办法
5681
查看次数

标签 统计

c++ ×1

casting ×1

char-pointer ×1

hdl ×1

verilog ×1