如果我有这样的声明:
int foo1 (int foo2 (int a));
Run Code Online (Sandbox Code Playgroud)
如何实现此foo1
功能?喜欢,
int foo1 (int foo2 (int a))
{
// How can I use foo2 here, which is the argument?
}
Run Code Online (Sandbox Code Playgroud)
我该如何调用foo1
函数main
?喜欢:
foo1(/* ??? */);
Run Code Online (Sandbox Code Playgroud) 例如,我有 class A
,并且有feature/A
用于实现 class 的分支A
。
我应该创建一个新的功能分支feature/TestA
来实现类的单元测试A
吗?
A
或者我应该在同一分支中实施类的单元测试feature/A
?
这个问题的最佳实践是什么?
这是我的代码.(我简化了这一点,通常有很多成员函数,但错误仍然相同,所以我简化了它.)
template <class K,class V>
class MyMap:public MySet<pair<K, V> >{};
int main(void){
MyMap<int,int> map1;
MyMap<int,int>::MyIterator it;
it=map1.begin();
cout<<it->first<<endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud) 在下面的示例中,我创建了3个其他过程,并且我还有1个主要过程。因此,总共有四个正在执行的过程。我的问题是,可以通过控制fork
系统调用函数的返回值来检查哪个进程是父进程,哪个进程是子进程。但是,如何检测主流程执行情况?主流程和父流程之间有什么区别?
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
int main()
{
int a =fork();
int b =fork();
if (a == 0)
printf("Hello from Child(A)!\n");
// parent process because return value non-zero.
else
printf("Hello from Parent(A)!\n");
if (b == 0)
printf("Hello from Child(B)!\n");
// parent process because return value non-zero.
else
printf("Hello from Parent(B)!\n");
return 0;
}
Run Code Online (Sandbox Code Playgroud) c ×2
c++ ×1
fork ×1
git ×1
git-branch ×1
inheritance ×1
java ×1
std-pair ×1
stl ×1
templates ×1
unit-testing ×1