s*a
2 楼
有一个小项目,一两个月的时间 part time 即可。但是需要有足够经验可以
自己从零架构起来的。请大家推荐或者自荐。报酬可议。
自己从零架构起来的。请大家推荐或者自荐。报酬可议。
m*t
3 楼
say I have two functions:
void testFunc(int &i, int &j) {
//some complex operation to get both x and y
i = x;
j = y; //getting y is cheap if x is computed
}
void testFunc(int &i) {
// some complex operation to get x
i = x;
}
then i have some call testFunc(i), some call testFunc(i, j).
I am wondering if I should write testFunc(int &i) as this:
void testFunc(int &i) {
int junk;
testFunc(i, junk);
}
feel it is really ugly but i donot want duplicate the code to calculate x.
Any id
void testFunc(int &i, int &j) {
//some complex operation to get both x and y
i = x;
j = y; //getting y is cheap if x is computed
}
void testFunc(int &i) {
// some complex operation to get x
i = x;
}
then i have some call testFunc(i), some call testFunc(i, j).
I am wondering if I should write testFunc(int &i) as this:
void testFunc(int &i) {
int junk;
testFunc(i, junk);
}
feel it is really ugly but i donot want duplicate the code to calculate x.
Any id
e*a
5 楼
it depends on how i and j are related.
why not include testFunc(i) in testFun(i,j) or add an helper function for
both of them?
【在 m***t 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: say I have two functions:
: void testFunc(int &i, int &j) {
: //some complex operation to get both x and y
: i = x;
: j = y; //getting y is cheap if x is computed
: }
: void testFunc(int &i) {
: // some complex operation to get x
: i = x;
: }
why not include testFunc(i) in testFun(i,j) or add an helper function for
both of them?
【在 m***t 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: say I have two functions:
: void testFunc(int &i, int &j) {
: //some complex operation to get both x and y
: i = x;
: j = y; //getting y is cheap if x is computed
: }
: void testFunc(int &i) {
: // some complex operation to get x
: i = x;
: }
t*t
7 楼
why don't you do the other way, i.e. testfunc(i,j) call testfunc(i) then
calculate j.
【在 m***t 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: say I have two functions:
: void testFunc(int &i, int &j) {
: //some complex operation to get both x and y
: i = x;
: j = y; //getting y is cheap if x is computed
: }
: void testFunc(int &i) {
: // some complex operation to get x
: i = x;
: }
calculate j.
【在 m***t 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: say I have two functions:
: void testFunc(int &i, int &j) {
: //some complex operation to get both x and y
: i = x;
: j = y; //getting y is cheap if x is computed
: }
: void testFunc(int &i) {
: // some complex operation to get x
: i = x;
: }
m*t
9 楼
ok. testfunc actually parses a document. Parsing a document is expensive,
while checking for certain field is cheap. If parameter j is there, i need
check for j after I get the document object. If j is not there, i donot do
the checking on j field.
【在 t****t 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: why don't you do the other way, i.e. testfunc(i,j) call testfunc(i) then
: calculate j.
while checking for certain field is cheap. If parameter j is there, i need
check for j after I get the document object. If j is not there, i donot do
the checking on j field.
【在 t****t 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: why don't you do the other way, i.e. testfunc(i,j) call testfunc(i) then
: calculate j.
i*e
10 楼
花了300人民币不到
太便宜了!
太便宜了!
A*o
11 楼
how about this way:
void testFunc(int& i, int* j=NULL)
{
//Then test if j == NULL or not
}
by this way, you just have one interface to call
【在 m***t 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: say I have two functions:
: void testFunc(int &i, int &j) {
: //some complex operation to get both x and y
: i = x;
: j = y; //getting y is cheap if x is computed
: }
: void testFunc(int &i) {
: // some complex operation to get x
: i = x;
: }
void testFunc(int& i, int* j=NULL)
{
//Then test if j == NULL or not
}
by this way, you just have one interface to call
【在 m***t 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: say I have two functions:
: void testFunc(int &i, int &j) {
: //some complex operation to get both x and y
: i = x;
: j = y; //getting y is cheap if x is computed
: }
: void testFunc(int &i) {
: // some complex operation to get x
: i = x;
: }
n*r
17 楼
Kindle上装个“多看”,联小米帐号。多看可以试读,喜欢再买。
相关阅读
node.js multer: Recursive process.nextTick detected第一个go项目快上线了问一个思路:如何创建并监听虚拟网卡继安卓后 iOS设备销量也将超过Windows电脑Netty和JavaEE高人来讲讲这个Amazon的API gatewaycxx程序如何给optimized build加函数symbol?go这个首字母大小写代表public或者private是个很噁心的feature吧?app securityquestion about google algorithm/architecture (转载)利用kafka 幫助不同进程见传输数据靠谱么 (转载)请教赵策老师有没有C++的restful service frameworknode.js child process: 怎样保证1个命令执行完了再执行下一个?Re: 劈柴进狗狗是靠刷题么? (转载)经济危机什么时候来?windows的file search怎么做的这么烂go这么屌?TIOBE Index August Headline: Java stronger in the leadiOS类似Picasso这样的库哪个最好