some strict cxx98 check

This commit is contained in:
tqchen 2015-04-27 17:37:07 -07:00
parent 48bcc021f7
commit 279758a92e
6 changed files with 14 additions and 6 deletions

View File

@ -141,7 +141,7 @@ class SingleFileSplit : public dmlc::InputSplit {
class StdFile : public dmlc::Stream {
public:
explicit StdFile(FILE *fp, bool use_stdio)
explicit StdFile(std::FILE *fp, bool use_stdio)
: fp(fp), use_stdio(use_stdio) {
}
virtual ~StdFile(void) {
@ -180,6 +180,7 @@ InputSplit* InputSplit::Create(const char *uri,
unsigned part,
unsigned nsplit,
const char *type) {
using namespace std;
using namespace xgboost;
const char *msg = "xgboost is compiled in local mode\n"\
"to use hdfs, s3 or distributed version, compile with make dmlc=1";
@ -190,13 +191,14 @@ InputSplit* InputSplit::Create(const char *uri,
}
Stream *Stream::Create(const char *fname, const char * const mode, bool allow_null) {
using namespace std;
using namespace xgboost;
const char *msg = "xgboost is compiled in local mode\n"\
"to use hdfs, s3 or distributed version, compile with make dmlc=1";
utils::Check(strncmp(fname, "s3://", 5) != 0, msg);
utils::Check(strncmp(fname, "hdfs://", 7) != 0, msg);
FILE *fp = NULL;
std::FILE *fp = NULL;
bool use_stdio = false;
using namespace std;
#ifndef XGBOOST_STRICT_CXX98_

View File

@ -15,6 +15,7 @@ DataMatrix* LoadDataMatrix(const char *fname,
bool savebuffer,
bool loadsplit,
const char *cache_file) {
using namespace std;
std::string fname_ = fname;
const char *dlm = strchr(fname, '#');

View File

@ -112,6 +112,7 @@ class LibSVMPageFactory {
inline void ParseBlock(char *begin,
char *end,
LibSVMPage *out) {
using namespace std;
out->Clear();
char *p = begin;
while (p != end) {

View File

@ -255,7 +255,7 @@ class FMatrixPage : public IFMatrix {
protected:
inline bool TryLoadColData(void) {
FILE *fi = fopen64(col_meta_name_.c_str(), "rb");
std::FILE *fi = fopen64(col_meta_name_.c_str(), "rb");
if (fi == NULL) return false;
utils::FileStream fs(fi);
LoadMeta(&fs);

View File

@ -55,8 +55,10 @@ inline void ThreadExit(void *status) {
} // namespace xgboost
#else
// thread interface using g++
extern "C" {
#include <semaphore.h>
#include <pthread.h>
}
namespace xgboost {
namespace utils {
/*!\brief semaphore class */
@ -120,6 +122,7 @@ class Semaphore {
}
#endif
};
/*!\brief simple thread class */
class Thread {
private:

View File

@ -31,7 +31,8 @@ class ThreadBuffer {
}
/*!\brief set parameter, will also pass the parameter to factory */
inline void SetParam(const char *name, const char *val) {
if (!std::strcmp( name, "buffer_size")) buf_size = atoi(val);
using namespace std;
if (!strcmp( name, "buffer_size")) buf_size = atoi(val);
factory.SetParam(name, val);
}
/*!