Gnu C++ stream.h char* form(const char*, ...)

Gnu C++ stream.h char* form(const char*, ...)

Post by Edwin Tisda » Fri, 22 Apr 1994 15:33:24

I just installed the latest version of the slackware distribution
with version 2.5.8 of the Gnu C++ compiler, `g++', and version 2.5.3
of the Gnu C++ library, `libg++'.  I discovered the following problem:

        unix% cat test.C
        #include <stream.h>

        int main(int argc, char** argv) {
          cout  << form("something\t")
                << form("and something else\n");
          cout  << "end of test\n";

        unix% g++ test.C
        unix% a.out
        something       something       end of test

We have the same versions on our Sun 4 computers which produce
the correct output:

        something       and something else
        end of test

Could someone please tell me how to fix or work around this problem?


1. C++: const int and const char* members in classes

Hi everybody!

Maybe someone can give me help on this problem?
Im just writing a class which needs a number of constant numbers and
strings. So I naivley started off like this:

class foo
    const unsigned int a_number=7;
    const unsigned char a_string[] =
    a_function(const unsigned int &, const unsigned char* );

{ ...

this is fine for the compiler (g++) but produces a linker error
(undefined ref. to a_number, a_string).
Strange to me is that when I use

{ ...
unsigned int b_number=a_number;

theres no error thrown for a_number but the trick doesnt work for the
const char*.  I tried to move the definition into the constructor
foo::foo():a_string={...} , ... {
and chaught some compiler errors, so what is the way its meant to be?
The only workaround I can think of is using static members (didnt try
yet) but shouldnt there be another way?

Thanks in advance for any help / hints!

eckardt _at_

2. installing redhat linux 7.1 in a box

3. [2.5] const char* to char* conversion in console.h

4. Sound on RedHat 6.2

5. const char* to char* update in console.h

6. Wanted Unix Code for a simple Password Routine

7. [2.5] const char* to char* update in console.h

8. V7-SPEA Mirage, svgalib

9. const char* to char* update in console.h

10. 2.4.3-ac5 - static const char *foo to static char foo[]

11. [2.4] const char* to char* conversion in console.h

12. char *strcasestr(char *haystack, char *needle) a simple case independent strstr()

13. Sparcworks C/C++: unsigned char vs signed char