Fix gcc.c-torture/execute/ieee/cdivchkf.c on hpux
[official-gcc.git] / libvtv / testsuite / libvtv.cc / environment.cc
blobaf1a87752986c4c43ed964878595f497888d323e
1 // { dg-do run }
3 extern "C" int printf(const char *, ...);
5 class Environment {
6 public:
7 virtual ~Environment();
9 // Static factory method that returns the implementation that provide the
10 // appropriate platform-specific instance.
11 static Environment* Create();
13 // Gets an environment variable's value and stores it in |result|.
14 // Returns false if the key is unset.
15 virtual bool GetVar(const char* variable_name, char* result) = 0;
18 class EnvironmentImpl : public Environment {
19 public:
20 virtual bool GetVar(const char* variable_name, char* result) {
21 return true;
25 Environment::~Environment() {}
27 // static
28 Environment* Environment::Create() {
29 return new EnvironmentImpl();
32 int main()
34 char * null = 0;
35 Environment * env = Environment::Create();
36 env->GetVar(0, null);
37 printf("%p\n", env);