Menu

#3 const char *

open
nobody
None
2
2012-09-15
2009-04-24
No

Declaration of string constants as char * has been deprecated. This is resolved by using const as appropriate.

Index: trunk/include/grid.hpp

--- trunk/include/grid.hpp (revision 8)
+++ trunk/include/grid.hpp (working copy)
@@ -476,7 +478,7 @@
/////////////////////////////////////////////////////////////////////////////

template < typename Particle , typename Grid >
-void _placement_error( Particle& p , Grid& g , char * message )
+void _placement_error( Particle& p , Grid& g , const char * message )
{
std::cerr << "An error occured shifting a particle around in the voxels: "
<< message << '\n';

Index: trunk/src/lglayout.C

--- trunk/src/lglayout.C (revision 8)
+++ trunk/src/lglayout.C (working copy)
@@ -55,7 +55,7 @@
char * initPosFile = 0;
char * initMassFile = 0;
char * rootNode = 0;

  • char * outfile = "lgl.out";
  • const char * outfile = "lgl.out";
    bool doesWritemstfile = false;
    long processorCount = 1;
    prec_t cutOffPrecision = .00001;

Index: trunk/src/calcFuncs.C

--- trunk/src/calcFuncs.C (revision 8)
+++ trunk/src/calcFuncs.C (working copy)
@@ -489,9 +489,9 @@

void printOutput( long i , prec_t d , long la , ostream& o )
{

  • char * im = "Iteration: ";
  • char * dx = " Dx: ";
  • char * l = " Level: ";
  • const char * im = "Iteration: ";
  • const char * dx = " Dx: ";
  • const char * l = " Level: ";
    if ( iteration__ > 0 ) {
    int j=0;
    while ( ++j<=(24+20) ) { o << '\b'; }

Index: trunk/src/lglrebuild.C

--- trunk/src/lglrebuild.C (revision 8)
+++ trunk/src/lglrebuild.C (working copy)
@@ -43,7 +43,7 @@
///////////////////////////////////////////////////////////

prec_t defaultradius = 1.0;
-char * defaultoutfile = "results.coords";
+const char * defaultoutfile = "results.coords";
prec_t defaultstepsize = .49;

///////////////////////////////////////////////////////////
@@ -69,7 +69,7 @@
displayUsage( argv );
}

  • char * outfile = defaultoutfile;
  • const char * outfile = defaultoutfile;
    char * fileList = 0;
    prec_t radius = defaultradius;
    prec_t stepSize = defaultstepsize;

Index: trunk/src/lglbreakup.C

--- trunk/src/lglbreakup.C (revision 8)
+++ trunk/src/lglbreakup.C (working copy)
@@ -34,7 +34,7 @@

/////////////////////////////////////////////////////////////////////////

-char * doutputdir = "/tmp/lgl_temp";
+const char * doutputdir = "/tmp/lgl_temp";
const bool defaultWrite = true;
const prec_t cutoff = 1e30;
const bool defaultDoesWriteLgl = true;
@@ -71,7 +71,7 @@
}

// Defaults

  • char * outputdir = doutputdir;
  • const char * outputdir = doutputdir;
    bool doesWrite = defaultWrite;
    bool writeNewLGL = defaultDoesWriteLgl;
    bool useMST = false;

Discussion

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB