Re: OT: C++ help

2008-05-22 Thread Mike Bird
On Thu May 22 2008 10:49:25 Jordi Gutiérrez Hermoso wrote: > You keep talking about scope. The access specifier should affect scope > and name resolution? This does not make sense! The public function is > available, a using declaration should bring that function from A's > scope into B's scope, bu

Re: OT: C++ help

2008-05-22 Thread Jordi Gutiérrez Hermoso
On 22/05/2008, Mike Bird <[EMAIL PROTECTED]> wrote: > On Thu May 22 2008 06:34:27 Jordi Gutiérrez Hermoso wrote: > > The first thing to note is that neither of these is your original > example, so it would be better if you had written "the *only* > difference between the two examples above is the

Re: OT: C++ help

2008-05-22 Thread Mike Bird
On Thu May 22 2008 06:34:27 Jordi Gutiérrez Hermoso wrote: > On 21/05/2008, Mike Bird <[EMAIL PROTECTED]> wrote: > > On Wed May 21 2008 20:01:10 Jordi Gutiérrez Hermoso wrote: > > > So what's the fix here? Why does a using A::f declaration inside class > > > B not work? > > > > There's no f(int)

Re: OT: C++ help

2008-05-22 Thread Jordi Gutiérrez Hermoso
On 21/05/2008, Mike Bird <[EMAIL PROTECTED]> wrote: > On Wed May 21 2008 20:01:10 Jordi Gutiérrez Hermoso wrote: > > > So what's the fix here? Why does a using A::f declaration inside class > > B not work? > > > There's no f(int) in scope, only int(foo). No, no, wait. This makes no sense. Consid

Re: OT: C++ help

2008-05-22 Thread Hugo Vanwoerkom
Mike Bird wrote: On Wed May 21 2008 20:01:10 Jordi Gutiérrez Hermoso wrote: On 21/05/2008, Mike Bird <[EMAIL PROTECTED]> wrote: On Wed May 21 2008 19:00:27 Jordi Gutiérrez Hermoso wrote: > The problem seems to be that all of my functions being named f are > somehow colliding with each other.

Re: OT: C++ help

2008-05-21 Thread al davis
On Wednesday 21 May 2008, Jordi Gutiérrez Hermoso wrote: > The following code will not compile: > >      class foo{}; > >      class A{ >      public: >        void f(int a ){a++;}; >      private: >        virtual void f(foo a) = 0; >      }; > >      class B : public A{ >      private: >        v

Re: OT: C++ help

2008-05-21 Thread Mike Bird
On Wed May 21 2008 20:01:10 Jordi Gutiérrez Hermoso wrote: > On 21/05/2008, Mike Bird <[EMAIL PROTECTED]> wrote: > > On Wed May 21 2008 19:00:27 Jordi Gutiérrez Hermoso wrote: > > > The problem seems to be that all of my functions being named f are > > > somehow colliding with each other. > > > >

Re: OT: C++ help

2008-05-21 Thread Jordi Gutiérrez Hermoso
On 21/05/2008, Mike Bird <[EMAIL PROTECTED]> wrote: > On Wed May 21 2008 19:00:27 Jordi Gutiérrez Hermoso wrote: > > The problem seems to be that all of my functions being named f are > > somehow colliding with each other. > > > Annotated C++ Reference Manual, Ellis & Stroustrup, Section 13.1 >

Re: OT: C++ help

2008-05-21 Thread Mike Bird
On Wed May 21 2008 19:00:27 Jordi Gutiérrez Hermoso wrote: > The problem seems to be that all of my functions being named f are > somehow colliding with each other. Annotated C++ Reference Manual, Ellis & Stroustrup, Section 13.1 (Declaration Matching). "A function member of a derived class is no

OT: C++ help

2008-05-21 Thread Jordi Gutiérrez Hermoso
Feel free to redirect me to a better place to ask if you know of one. The following code will not compile: class foo{}; class A{ public: void f(int a ){a++;}; private: virtual void f(foo a) = 0; }; class B : public A{ private: virtual void

Re: [OT] C help plz..

2000-03-17 Thread Matthew Dalton
One could easily expand the code snippet to something more like... int i; char c; unsigned long l; : : for (i = sizeof(unsigned long); i > 0; i--) { int shift_factor = (i - 1) * 8; c = (char)((l & ((unsigned long)0xFF << shift_factor)) >> shift_factor); putchar(c); } ... if you want t

Re: [OT] C help plz..

2000-03-16 Thread Sean 'Shaleh' Perry
On 16-Mar-2000 Shao Zhang wrote: > Thanks. This is exactly what I want. I have thought about doing it this > way, it is just that from memory, there is a libc function that does the > equivalent. > What was given is the only safe and sane way I have ever seen. Bigger question is why do you have

RE: [OT] C help plz..

2000-03-16 Thread Lewis, James M.
You could just do: fflush (stdout); /* clear the stream buffer */ write (1, myvar, 4); /* write binary to stdout */ jim > Thanks. This is exactly what I want. I have thought about doing it this > way, it is just that from memory, there is a libc function that does the > equivalent.

Re: [OT] C help plz..

2000-03-16 Thread Shao Zhang
Thanks. This is exactly what I want. I have thought about doing it this way, it is just that from memory, there is a libc function that does the equivalent. shao. Matthew Dalton [EMAIL PROTECTED] wrote: > Sorry... I automatically made a link between binary data and hexadecimal > data... > > You

Re: [OT] C help plz..

2000-03-16 Thread Matthew Dalton
Sorry... I automatically made a link between binary data and hexadecimal data... You could shift 8 bits of the unsigned long into a unsigned char one at a time, and print that character with a %c in the printf, or use putchar() or something. eg: unsigned long l = 0x38c9616e; unsig

Re: [OT] C help plz..

2000-03-16 Thread Eric G . Miller
On Thu, Mar 16, 2000 at 03:04:53PM +1100, Shao Zhang wrote: > Hi, > If I have an unsigned long int, instead printing out its values > in string using printf("%ld\n", my_var), > > I would like to print it out as a 4-byte binary data. Is there > any easy way to do this in C.

Re: [OT] C help plz..

2000-03-16 Thread Shao Zhang
But isn't %[Xx] just prints out as Hexdecimal? I just tried, and it prints out something like: 38c9616e which consumes 8 bytes in a file. Given that unsigned long is 32 bits, I want to use exactly 4 byte to represent it in order to save some space. Thanks. Shao. Matthew Dalton [EMAIL PROTECTED]

[OT] C help plz..

2000-03-16 Thread Shao Zhang
Hi, If I have an unsigned long int, instead printing out its values in string using printf("%ld\n", my_var), I would like to print it out as a 4-byte binary data. Is there any easy way to do this in C. Thanks. Shao. --