d****n 发帖数: 1637 | 1 Try this.
Fill as many char size as you could reach
//file define.c
//transfer must be put at the end of array if overrun index
// and you dont want to calculate the size.
// precisely use trans(x, n) macro
//if you really assign a large char array, then take my first approach.
#include
#include
//unsafe but ok
#define transfer(x) trans(x, 10)
#define trans(x, n) trans##n(x), #x[n]
#define trans10(x) trans9(x), #x[9]
#define trans9(x) trans8(x), #x[8]
#define trans8(x) tra... 阅读全帖 |
|
T**S 发帖数: 319 | 2 【 以下文字转载自 Linux 讨论区 】
发信人: TINS (TINS), 信区: Linux
标 题: 两个C的#define问题
发信站: BBS 未名空间站 (Fri Aug 24 14:11:27 2007), 转信
1) 能用#define 来改变变量或function名字吗?比如:
#define X 1
然后用类似如:int aX;
其实是想得到: int a1;
2) #define 能嵌套吗?比如:
#define a #define b 1
然后用
a
其实想得到:
#define b 1
上面两个例子都不对,但能可行吗? |
|
l****z 发帖数: 29846 | 3 By Patrick Goodenough
June 4, 2012
(CNSNews.com) – U.N. Secretary-General Ban Ki-moon addressed the advisory
board of a newly-established U.N. Counter-Terrorism Center in Saudi Arabia
on Sunday but was silent on the world body’s enduring failure to come up
with a universal definition of terrorism.
For well over a decade, the biggest single obstacle preventing a U.N.
agreement on defining terrorism has been the insistence by Muslim states
belonging to the Organization of Islamic Cooperation (OIC)... 阅读全帖 |
|
e*****r 发帖数: 379 | 4 现在在理解一个open source project, 发现里面的#define多如牛毛。---为什么C++
guy likes #define???
问题2:为什么#define的命名,一般都有个 "....._H" 或者 "_HH" , for
example:
#define GlobalUnixMakefileGenerator3_H
别见笑,问题很初级。多谢! |
|
c**********e 发帖数: 2007 | 5 What is difference between define and preprocessor?
这是个Bloomberg面试题。不明白,难道define, preprocessor这两个不是一丘之貉吗
?define定义了宏,preprocessor把值放进去。 |
|
m****s 发帖数: 18160 | 6 【 以下文字转载自 JobHunting 讨论区 】
发信人: Tardigrades (Water Bear), 信区: JobHunting
标 题: 转贴一个硅工职位信息-Sr.Product Definer @RTP,NC
发信站: BBS 未名空间站 (Thu Oct 25 21:24:47 2012, 美东)
一个朋友提供的,给大家看着玩
COMPANY INFORMATION:
Intersil Corporation is a leader in the design and manufacture of high-
performance analog, mixed-signal and power management semiconductors. The
Company's products address some of the fastest growing markets within the
industrial and infrastructure, personal computing and high-end consumer
markets. ... 阅读全帖 |
|
P*****D 发帖数: 141 | 7 【 以下文字转载自 I485 讨论区 】
发信人: ProbeID (ProbeID), 信区: I485
标 题: I485 case 在状态显示 user defined error??什么意思
发信站: BBS 未名空间站 (Mon Apr 20 23:33:41 2015, 美东)
USCIS case status 我的I485 case 查不到,显示 user defined error,其他I140,
AP,EDA 的case都可以查到 状态是case has been received,律师说的USCIS的网站有
时有问题,可是好几天了,我I485的case 一直是显示user defined error,有谁知道
怎么回事吗?
我EB1B,I140交了3个多月,I485交了2个多月,都在等消息。 |
|
b*****f 发帖数: 851 | 8 I have a major concern of how to define my field. I am now writing to ask
for your suggestions.
Basically, my research work has focused on the following two areas,
1. Bioactive peptides in venomous cone snails (conopeptides or conotoxins),
particularly the isolation and characterization of novel conopeptide ligands
which can discriminate between closely related receptors and ion channels
and be developed for the treatment of neuropathic and inflammatory pain.
Conopeptides or conotoxins are neu... 阅读全帖 |
|
|
P*****D 发帖数: 141 | 9 【 以下文字转载自 I485 讨论区 】
发信人: ProbeID (ProbeID), 信区: I485
标 题: I485 case 在状态显示 user defined error??什么意思
发信站: BBS 未名空间站 (Mon Apr 20 23:33:41 2015, 美东)
USCIS case status 我的I485 case 查不到,显示 user defined error,其他I140,
AP,EDA 的case都可以查到 状态是case has been received,律师说的USCIS的网站有
时有问题,可是好几天了,我I485的case 一直是显示user defined error,有谁知道
怎么回事吗?
我EB1B,I140交了3个多月,I485交了2个多月,都在等消息。 |
|
P*****D 发帖数: 141 | 10 【 以下文字转载自 I485 讨论区 】
发信人: ProbeID (ProbeID), 信区: I485
标 题: I485 case 在状态显示 user defined error??什么意思
发信站: BBS 未名空间站 (Mon Apr 20 23:33:41 2015, 美东)
USCIS case status 我的I485 case 查不到,显示 user defined error,其他I140,
AP,EDA 的case都可以查到 状态是case has been received,律师说的USCIS的网站有
时有问题,可是好几天了,我I485的case 一直是显示user defined error,有谁知道
怎么回事吗?
我EB1B,I140交了3个多月,I485交了2个多月,都在等消息。 |
|
l*****g 发帖数: 525 | 11 谢谢楼主的模版。我稍微改了一下,以方便码工硅工互相跳。其实draft的原文提到了
15(计算机类)和17(工程类)的portability的情况,但我还是建议他们具体化,并
且可以用BLS的数据作为参考。
Email to: [email protected]
/* */
ATTN: The Same or a Similar Occupational Classification” for Purposes of
Section 204(j) Job Portability
Comments on Draft PM-602-0122
Dear USCIS Adjudication Committee,
The purpose of this email is to provide comments on the Draft Memo 602-0122
which was released on November 20, 2015.
As one of the skilled immigrants waiting several years for the green ca... 阅读全帖 |
|
x********g 发帖数: 47 | 12 In C++ program, we use #define a to define variable "a".
enter dos by type cmd in run menu.
请问怎么在command line里define variable "a" |
|
D***h 发帖数: 183 | 13 For example, for tables A, B with Name, ID
I want to
select A.Name
from A, B
where A.Name = B.Name
but here the = is not strict equal. They are seen to be equal if these two
strings A.Name and B.Name are different with at most 1 character. For
example, 'John' and 'Johnn' are equal.
Is there any way to define a function to deal with this? Can I define a
function else where to define this equal, than then use it after "where"?
Thanks |
|
m******e 发帖数: 7 | 14 Hello everyone,
I write a text editor and add a ruler (the class Ruler from the link
http://java.sun.com/products/jfc/tsc/articles/text/tabs/ ) to my JTextPane.
Everything works well. The user can define tabs in different positions, and
the text can be aligned to the new defined tabs.
But as I use
RTFEditorKit.write(outputStream, the_doc_in_JTextPane, 0, doc.getLength())
to save the document as a .rtf file, all the user defined tabs are lost and
the default tabs are saved (that means all the tab |
|
yy 发帖数: 45 | 15 看到一个example 里有:
#define assert(v) { if ((v) == 0) printf(" binarysearch bug %d %d\n", i, n);}
请问这个 define 是用来干嘛的,
看到过 #define PI 3.1415, 这个是用来定义常数的, 倒容易理解
谢谢 |
|
q*c 发帖数: 9453 | 16 yeah. I hate define as well. I am so happy to see C# disabled define
that way...
Define is too messy once proj become large. |
|
r****t 发帖数: 10904 | 17 非 template 情况似乎比较清楚了,class template 里面的 static data
member 的定义和初始化有没有啥龟腚?
举个例子:
template
class StackWithCapacity : public stack_adapter
{
public:
typedef typename stack_adapter< Container>::size_type size_type;
private:
static const size_type capacity = 5;
};
capacity 是个 static const member, 我就直接在 class body 里面初始化了,
据 c++ primer,class body 外面还必须 define without initializer (虽然我我不这么做也能编译并运行正常). 这样我就在外面加
template
StackWithCapacity... 阅读全帖 |
|
w*****s 发帖数: 122 | 18 XML is defined by a number of related specifications:
Extensible Markup Language (XML) 1.0
Defines the syntax of XML. The XML specification is the primary focus of
this article.
XML Pointer Language (XPointer) and XML Linking Language (XLink)
Defines a standard way to represent links between resources. In addition to
simple links, like HTML's tag, XML has mechanisms for links
between multiple r |
|
w********r 发帖数: 9 | 19 How to define the correlation of two variable X and Y defined in different
domain? For example, X is a continuous function in [0,1], but Y is in [0,1/2
]. |
|
l*******m 发帖数: 1096 | 20 I think your distance function was defined in a wrong way. Here is an
example
def test_pyfunc_metric():
def dist_func(x1, x2, p):
return np.sum((x1 - x2) ** p) ** (1. / p)
X = np.random.random((10, 3))
euclidean = DistanceMetric.get_metric("euclidean")
pyfunc = DistanceMetric.get_metric("pyfunc", func=dist_func, p=2)
D1 = euclidean.pairwise(X)
D2 = pyfunc.pairwise(X)
assert_array_almost_equal(D1, D2)
I didn't know it before, just checked source codes for you.
... 阅读全帖 |
|
l****z 发帖数: 29846 | 21 In a culture where marriage can be defined to mean anything…
June 1, 2012 by Rick Rice
… then anything can be defined to be a marriage:
36-year-old North Dakota woman who married herself in a commitment
ceremony last March has now spoken about her self-marriage choice in an
interview with Anderson Cooper.
The marriage took place among friends and family who were encouraged to
“blow kisses to the world” after she exchanged rings with her “inner
groom”, My Fox Phoenix reports.
“I feel... 阅读全帖 |
|
c******l 发帖数: 111 | 22 各位faculty,你们都选的是那种退休计划啊?我们这里的情况是可以选本州的pension
plan - 即defined benefit plan,不能自主投资,风险小很多,但是不灵活一旦变动
工作就不合算;或者是选ORP (optional retirement plan),自主投资,风险大,但
是可以随身携带,不受变动工作的影响。本人35-40岁,老公也差不多年龄,都是
faculty,我们该怎样选呢? |
|
b********e 发帖数: 1796 | 23 现在很多学校都有1和2的交叉的,就是如果你待到退休还是define benefit,但是如果
你move的话钱也是可以拿出来的(按照你每月扣的算),我觉得这种最好。
当然如果没有的话,就看你是不是打算在那里呆一辈子了 |
|
c**********e 发帖数: 2007 | 24 #define a 10
void main()
{
#define a 50
printf("%d",a);
}
What is the output?
a) 10
b) 50
c) Compiling error. |
|
m********1 发帖数: 31 | 25 "Effective C++" Meyers mentions a reason for a pure virtual function to have
a body: Derived classes that implement this pure virtual function may call
this implementation smwhere in their code. If part of the code of two
different derived classes is similar then it makes sense to move it up in
the hierarchy, even if the function should be pure virtual.
ISO C++ 12.4 (7):
A destructor can be declared virtual (10.3) or pure virtual (10.4); if any
objects of that class or any derived class are crea... 阅读全帖 |
|
T*********s 发帖数: 17839 | 26 一个朋友提供的,给大家看着玩
COMPANY INFORMATION:
Intersil Corporation is a leader in the design and manufacture of high-
performance analog, mixed-signal and power management semiconductors. The
Company's products address some of the fastest growing markets within the
industrial and infrastructure, personal computing and high-end consumer
markets. For more information about Intersil or to find out how to become a
member of our winning team, visit the Company's website and career page at
www.intersil.com.
We ... 阅读全帖 |
|
P*****D 发帖数: 141 | 27 USCIS case status 我的I485 case 查不到,显示 user defined error,其他I140,
AP,EDA 的case都可以查到 状态是case has been received,律师说的USCIS的网站有
时有问题,可是好几天了,我I485的case 一直是显示user defined error,有谁知道
怎么回事吗?
我EB1B,I140交了3个多月,I485交了2个多月,都在等消息。 |
|
X**J 发帖数: 466 | 28 你在哪里看到只需要提供more likely true than not的证据就行了,我刚才和一个朋
友聊天的时候受到启示,h1b本来是要求做的工作和专业相关,现实生活中,据我所知
,东拉西扯,很多不相关的也批了,如果真的有你所说的有开放灵活的提交证据的就好
了。 我把我帖子其他地方的帖子拷在下面了。
My friend just gave me a very nice advice for defining similar jobs. We
should recommend USCIS allow the applicant to submit the evidence ,such as
the job description in the market, expert reference in the industry or any
evidence we can get, to prove the jobs are similar, just like they did for
h1b. After all the VOs are not familiar with the de... 阅读全帖 |
|
s**********i 发帖数: 711 | 29 you can ONLY define window size for new window.
you write a javascript function to open this window.
on your original page, you either use onLoad to
call this function (which means the new window with
your specified size will open right after a user
open your original page), or call this function
when the user click on one of the links in your
original page.
you can't define window size for a window opened
by the user him/herself. |
|
e******n 发帖数: 86 | 30 For a binary variable (it can contain either a 0 or a 1).
Is there any way I can define a data type that uses only 1 bit.
Currently, I defined it as byte variable.
//xiexie |
|
yy 发帖数: 45 | 31 Thanks!
不过, 这个挺让我吃惊的,我原先以为, 只可以define一个常数,
没想到还可以define function, 例如,上例中的 i 可以替换那个v. |
|
m***t 发帖数: 254 | 32 #include
#define REPLACE hello world
#define JOIN(a, b) a##b
int main() {
printf("JOIN(REP, LACE)\n");
return 0;
}
run on gcc, output:
JOIN(REP, LACE)
Why? |
|
m***t 发帖数: 254 | 33 Thanks. That works. But i am kind of curious since I thought preprocessor
should handle the string substitution. And i tried the following which gives
me compilation error.
#include
#define REPLACE hello world
#define JOIN(a, b) a##b
int main() {
printf("%s", JOIN(REP, LACE));
return 0;
} |
|
e******n 发帖数: 86 | 34 For a binary variable (it can contain either a 0 or a 1).
Is there any way I can define a data type that uses only 1 bit.
Currently, I defined it as byte variable
//xiexie |
|
t*i 发帖数: 72 | 35 为啥第二个是invalid的
valid define:
const std::string hello = "Hello";
const std::string message = hello + ", world" + "!";
invalid define:
const std::string exclam = "!";
const std::string message = "Hello" + ", world" + exclam; |
|
j******e 发帖数: 64 | 36 【 以下文字转载自 JobHunting 讨论区 】
发信人: justcome (ANewOne), 信区: JobHunting
标 题: 高手看看,这个define是用来干什么的?
发信站: BBS 未名空间站 (Mon Feb 25 14:42:03 2008), 站内
#define X(y, z) ((int) &(((y *) 0)->z)) |
|
k*******d 发帖数: 1340 | 37 我知道一般情况下都是在header里面declare function, 在cpp里面define
function,inline function 和 function template要放在header里面。
不过我最近写一个程序,把class definition以及member function的definition都放在
header里面,有一些member function不是function template ,有一些是function
template,结果link的时候出现错误,说那些不是function template的function "already
defined in"某另外一个obj文件,这个情况是在我一个project(VC 2008)里面有多个cpp文件的
时候出现的。刚写完这个class的时候我用了个简短的测试程序,那时候整个project还只有一个cpp
文件,就没有出现这个错误。而我把这些member function definition移到cpp文件里面去link
的错误就没了。
另外,在另一个header里面我还定义了个non-membe |
|
k*******d 发帖数: 1340 | 38 问题是,我有header guard,那么这个header的实际内容(也就是#ifndef #define 和
#endif之间的内容)只会被include一次吧,那么应该
function也只被define了一次啊
declare可以多次?应该也只能一次吧,完全一样的函数重复声明编译就会有错误
名词使用问题我改改吧,应该叫做function template比较确切,我是自己看C++ primer学的
以可以多
准了。
拿准 |
|
r*******y 发帖数: 1081 | 39 How to use a namespace defined in another file without include ?
for example:
//1.cpp
namespace cc{int i = 10;}
//2.cpp
#include
int main(){
std::cout << cc::i <
}
then compile: g++ -o 2 2.cpp 1.cpp
but error: cc has not been defined.
which directive should be added in 2.cpp? for example "extern namespace cc".
I tried but failed too.
Thanks |
|
O*******d 发帖数: 20343 | 40 因为C/C++compiler不能保证同一个头文件不被包括一次以上,所以码工需要多写几
行#define. 这种基本上成了标准写法
#ifndef XXXXX // 最先一行
#define XXXXX
头文件的内容
#endif //最后一行
对XXXXX的要求只需要独特即可。当然要满足identifier的条件。 |
|
k****t 发帖数: 2288 | 41 【 以下文字转载自 CS 讨论区 】
发信人: kermit (kk), 信区: CS
标 题: 请教怎么用#define实现如下的功能
发信站: BBS 未名空间站 (Thu Mar 22 20:10:19 2012, 美东)
给一个字符串,让他转成如下的格式:
比如 #define transfer(A) ........
我这样调用的时候
transfer(“abc”)
能得到如下的东西:
'a','0','b','0','c','0' |
|
k****t 发帖数: 2288 | 42 呵呵,你这个很强。
不过我很好奇的就是这个define会占instruction code的size吗?
我的想法很简单:就是简单,不容易出错,代码的size不增加。。。
比如
#include 。。。。
#define transfer(x) 。。。。
const unsigned char StrA1[] = {0xb,0xc,transfer("ABC")};
const unsigned char StrA2[] = {0xd,0xe,transfer("abcdedfg");
const unsigned char StrA3[] = {0xf,0x10,transfer("test signal");
.... |
|
k****t 发帖数: 2288 | 43 你这个编译有错~~~
说syntex error。
应该是这个define有问题
I am not sure what you need.
but by my understand ~
#include
#include
#include
#define transfer(x) ({char *tmp=(x); \
int i,sz=strlen(tmp);\
char *ret=(char *)malloc(sizeof(char)*sz*2);\
for(i=0;i
ret[2*i]=tmp[i];\
ret[2*i+1]='\0';\
}\
ret;})
int main(){
char *t;
t=tran... 阅读全帖 |
|
c**********e 发帖数: 2007 | 44 【 以下文字转载自 JobHunting 讨论区 】
发信人: careerchange (Stupid), 信区: JobHunting
标 题: Can we define pure virtual function?
发信站: BBS 未名空间站 (Wed Mar 28 22:22:19 2012, 美东)
class A {
public:
virtual int foo()=0;
};
A::foo() { return 0; }
That is can we have a function as pure virtual function
and also have defination like above?
Justify your answer. If yes, then tell me one situation
where we use that. If not tell me why not. |
|
a****l 发帖数: 8211 | 45 不懂你的意思.编译器不就是因为不知道这个#define的数值才问你的吗?你要编译器显
示什么数? |
|
s********i 发帖数: 145 | 46 That's exactly why you should favor "static const" over #define macro. |
|
k**l 发帖数: 2966 | 47 I have a question of c++ programing habit,
I sometimes use list, map or other container to store user defined classes,
and use it later in member functions--say
std::list m_list;
When inserting a new element, I always have to fully create an element, then
call push_back or insert.
MyElement elem(1,2,"something"...);
m_list.push_back(elem);
And push_back would call copy constructor (I defined in MyElement class) to
duplicate the object.
After inserting, the elem itself is never used an... 阅读全帖 |
|
n*****y 发帖数: 17 | 48 macro跟user defined function 有什么不同呢,两个都可以实现自动计算等。是不是
user defined function 只能返回具体的数值或数组,而macro则可执行一些其他的
operations? |
|
|
|