Re: KLD module with C++ iostreams ?

2005-04-21 Thread Dag-Erling Smørgrav
Aziz KEZZOU [EMAIL PROTECTED] writes:
 I am wondering if I can use c++ iostreams inside the kernel ?
 After all the code : cout  Hello world!  endl; 
 ends accessing the stdout just like : printf(Hello world!\n); right ?

There is no stdio in the kernel.

 So if I could compile my KLD module with static linkage to libstdc++,
 that should be ok, right ?

No.

DES
-- 
Dag-Erling Smørgrav - [EMAIL PROTECTED]
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: KLD module with C++ iostreams ?

2005-04-21 Thread Aziz KEZZOU
 David Leimbach wrote:
  Interesting question.  People usually have to implement the C++
  runtime to be usable from within the kernel.  Things like exceptions
  and stdout may not be defined in kernel space :)
 
  I'm not terribly familiar with how it works on FreeBSD but I know it
  took a special effort to get C++ support into linux.
 
  Dave
 
  On 4/20/05, Aziz KEZZOU [EMAIL PROTECTED] wrote:
 
 Hi hackers,
 I am wondering if I can use c++ iostreams inside the kernel ?
 After all the code : cout  Hello world!  endl;
 ends accessing the stdout just like : printf(Hello world!\n); right ?
 
 No, that's not true, all the iostreams stuff is totally independent.
 The iostreams stuff is coming from some of the ugliest code in C++.
 But, that's not the question, or at very least, it shouldn't BE the
 question.  There is ZERO need to bring in features from C++, all it will
 do is to directly confuse the code base by greatly adding to the
 complexity of the code, without giving anything like equivalent features.
 
 Some very, very elegant work has been code, OO-ing the kernel code,
 adding OO features, all without violating the C language code base.
 Adding in C++ features over stdio stuff is so senseless, it's nearly
 obscene.
 
 If the gain at the end of the road was large enough, I wouldn't be
 against it so stridently, but I see *so* little gain.
 
 BTW, you know where the ugliest code in computer science today is: half
 is in the actual implementation of the cstdio/template code, the other
 half is the iostreams stuff.  The fact that they energize some very
 elegant code is causing many folks never to see the fact of the horrible
 code lumps that exist out in the backyard.
 
 
 So if I could compile my KLD module with static linkage to libstdc++,
 that should be ok, right ?
 
 Any one did or knows how to do this ?
 

Thank you guys for responding to my post.
Certainly, it is not a good idea to use _all_ C++ stuff inside the
kernel ; in the linux community a similar suggestion resulted in a big
discussion of pros  cons. I was asking because I have a big portion
of C++ code that I am planning to move inside the kernel.

But, having compared the effort/time required to port C++ iostreams
into the kernel and the effort/time required to get rid of iostreams ,
I think I will abandon this challenge for now ;-)

Just to let you know virtual methods and templates, among others,
are supported inside the kernel...

Greetings,
-aziz
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: KLD module with C++ iostreams ?

2005-04-20 Thread David Leimbach
Interesting question.  People usually have to implement the C++
runtime to be usable from within the kernel.  Things like exceptions
and stdout may not be defined in kernel space :)

I'm not terribly familiar with how it works on FreeBSD but I know it
took a special effort to get C++ support into linux.

Dave

On 4/20/05, Aziz KEZZOU [EMAIL PROTECTED] wrote:
 Hi hackers,
 I am wondering if I can use c++ iostreams inside the kernel ?
 After all the code : cout  Hello world!  endl;
 ends accessing the stdout just like : printf(Hello world!\n); right ?
 
 So if I could compile my KLD module with static linkage to libstdc++,
 that should be ok, right ?
 
 Any one did or knows how to do this ?
 
 Thanks,
 -aziz
 ___
 freebsd-hackers@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
 To unsubscribe, send any mail to [EMAIL PROTECTED]

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: KLD module with C++ iostreams ?

2005-04-20 Thread Chuck Robey
David Leimbach wrote:
Interesting question.  People usually have to implement the C++
runtime to be usable from within the kernel.  Things like exceptions
and stdout may not be defined in kernel space :)
I'm not terribly familiar with how it works on FreeBSD but I know it
took a special effort to get C++ support into linux.
Dave
On 4/20/05, Aziz KEZZOU [EMAIL PROTECTED] wrote:
Hi hackers,
I am wondering if I can use c++ iostreams inside the kernel ?
After all the code : cout  Hello world!  endl;
ends accessing the stdout just like : printf(Hello world!\n); right ?
No, that's not true, all the iostreams stuff is totally independent. 
The iostreams stuff is coming from some of the ugliest code in C++. 
But, that's not the question, or at very least, it shouldn't BE the 
question.  There is ZERO need to bring in features from C++, all it will 
do is to directly confuse the code base by greatly adding to the 
complexity of the code, without giving anything like equivalent features.

Some very, very elegant work has been code, OO-ing the kernel code, 
adding OO features, all without violating the C language code base. 
Adding in C++ features over stdio stuff is so senseless, it's nearly 
obscene.

If the gain at the end of the road was large enough, I wouldn't be 
against it so stridently, but I see *so* little gain.

BTW, you know where the ugliest code in computer science today is: half 
is in the actual implementation of the cstdio/template code, the other 
half is the iostreams stuff.  The fact that they energize some very 
elegant code is causing many folks never to see the fact of the horrible 
code lumps that exist out in the backyard.

So if I could compile my KLD module with static linkage to libstdc++,
that should be ok, right ?
Any one did or knows how to do this ?
Thanks,
-aziz
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: KLD module with C++ iostreams ?

2005-04-20 Thread M. Warner Losh
In message: [EMAIL PROTECTED]
Aziz KEZZOU [EMAIL PROTECTED] writes:
: Hi hackers,
: I am wondering if I can use c++ iostreams inside the kernel ?
: After all the code : cout  Hello world!  endl; 
: ends accessing the stdout just like : printf(Hello world!\n); right ?

Just like, yes.  Exactly the same thing as, no.  The details matter
here.  There's a lot of code to make this happen.

: So if I could compile my KLD module with static linkage to libstdc++,
: that should be ok, right ?

No.

: Any one did or knows how to do this ?

I've done C++ in the kernel before.  IT is realtively easy to get very
basic functioanlity.  You won't have streams, exceptions, etc.
However, to have all the features of C++ would take a lot of work.

Warner


___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]