我可以用多线程制作 make -jN
我可以在 Makefile中指定多线程,以便make从命令行运行多个线程.这是我的makefile:
BIN_OBJS = $(wildcard *.bin)
HEX_OBJS = $(subst .bin,.hex,$(BIN_OBJS))
all: $(HEX_OBJS)
$(HEX_OBJS): %.hex: %.bin
python ../../tools/bin2h.py $< > $@
Run Code Online (Sandbox Code Playgroud) 以下程序失败:
abstract class A {
protected void method() {}
}
class B extends A {
private void method() {}
}
public class main{
public static void main(String []args) {}
}
Run Code Online (Sandbox Code Playgroud)
有:
main.java:6: error: method() in B cannot override method() in A
private void method() {}
^
attempting to assign weaker access privileges; was protected
1 error
Run Code Online (Sandbox Code Playgroud)
将派生方法设置为protected/private.
问题:Java不允许您进一步限制子类中的访问权限的原因是什么?我将此与C++形成对比,C++具有完全相反的规则.
在这个项目中,我需要从C文件中获取头文件中结构的大小.
我不能在C文件中包含头文件,因为struct包含不能用C编译的类.
有任何想法吗?
要从包含"hi"的行打印到包含"bye"的行,我会:
awk'/hi/./bye/'
要从包含"hi"的行打印到文件末尾,我会:
awk'/ hi /,0'
如何编写脚本以在这两种结束条件下结束打印?
为什么explicit vector (size_type n)表单在类之外工作但不在内部?这编译:
#include <vector>
int main() {
std::vector<int> vec_(3); // set capacity to 3
return 0;
}
Run Code Online (Sandbox Code Playgroud)
但不是这个:
#include <vector>
class C {
public:
std::vector<int> vec_(3); // set capacity to 3
};
int main() {
return 0;
}
g++ --std=c++0x -Wall -Wextra -g a.cpp
a.cpp:5:27: error: expected identifier before numeric constant
a.cpp:5:27: error: expected ‘,’ or ‘...’ before numeric constant
Run Code Online (Sandbox Code Playgroud)
为什么?:(
c++ ×2
awk ×1
c ×1
class ×1
compilation ×1
constructor ×1
inheritance ×1
java ×1
makefile ×1
mixed-code ×1
oop ×1
regex ×1
token ×1
vector ×1