https://github.com/root-project/root
Raw File
Tip revision: dc23f9fcef6b528a41995f8ce10463d5330581e6 authored by Fons Rademakers on 27 October 2012, 21:18:24 UTC
tag patch release v5-34-03.
Tip revision: dc23f9f
t986.cxx
/* -*- C++ -*- */
/*************************************************************************
 * Copyright(c) 1995~2005  Masaharu Goto (root-cint@cern.ch)
 *
 * For the licensing terms see the file COPYING
 *
 ************************************************************************/
// 030115string 030115string2
// Problem with const static 

//#include <string.dll>
#include <string>
#include <iostream>
using namespace std;
#ifndef G__ROOT
//#include "t986.dll"
typedef char Text_t;
#endif

//#define TEST
#ifdef TEST
string fname_long(const Text_t *a){
  string b="bbb";
  b += a;
  return b;
}
#endif

void t986(void){
  int i;
  const int maxsize=10;
  static double x[maxsize];
  static const string name="t986";

  for(i=0;i<maxsize;i++) x[i] = i*1.2;
  const string a(fname_long("eta"));   // fine

  cout << "maxsize=" << maxsize << " : " ;
  for(i=0;i<maxsize;i++) cout << x[i] << " " ;
  cout << endl;
  
  cout << "name=" << name << endl;
  cout << a << endl;
}

#ifndef TEST
string fname_long(const Text_t *a){
  string b="bbb";
  b += a;
  return b;
}
#endif

#ifndef G__ROOT
int main() {
  t986();
  return 0;
}
#endif
back to top