是否可以在Windows Phone 8中以编程方式发送短信?我环顾四周,对我的价格来说,没有找到任何东西......:s
如果foo()在varius平台上以不同的方式调用了函数,那么使用宏是否是错误的做法?
例如:
#ifdef WIN32
#define ffoo(a) foo(0)
#else
#define ffoo(a) foo(a)
#endif
Run Code Online (Sandbox Code Playgroud) 当列表中有NULL对象时,如何处理异常?
#include <iostream>
#include <string>
#include <vector>
#include <exception>
#include <Windows.h>
using namespace std;
class Test {
public:
string m_say;
void Say() {
cout << m_say << endl;
}
Test(string say) {
m_say = say;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
vector<Test*> lst;
Test * a = new Test("YO!");
lst.push_back(a);
lst.push_back(nullptr);
for (vector<Test*>::iterator iter = lst.begin(); iter != lst.end(); iter++)
{
try {
Test * t = *iter;
t->Say();
}
catch (exception& e) {
cout << e.what() << …Run Code Online (Sandbox Code Playgroud) 将缓冲区的大小定义为宏还是常量,这被认为是不好的做法吗?
例如:
char buffer[1024];
代替:
#define BUFF_SIZE 1024
char buffer[BUFF_SIZE];