Linux-Development-Sys Digest #109, Volume #7     Wed, 25 Aug 99 23:14:29 EDT

Contents:
  Re: Linking in arbitrary binary data (H. Peter Anvin)
  Re: PROPOSAL: A secure, simple NIS replacement (Peter Samuelson)
  Keyboard input rejected in X after upgrading to 2.3.14 kernel ("Scott Langley")
  Strange mount problem ("Norm Dresner")
  Compiler question (Fernando Ortega Bellosta)
  Re: What are difference between Monolithic kernel architecture & Microkernel 
architecture (Peter Samuelson)
  Re: why not C++? (Tristan Wibberley)
  Re: Strange mount problem ("Norm Dresner")
  Re: why not C++? (Tristan Wibberley)
  Re: Bypass Login (Eric Hegstrom)
  Re: why not C++? (Kaz Kylheku)
  Re: why not C++? ("Bruce W. Bigby")
  Re: Bypass Login (Robert Lynch)
  Re: Bypass Login (Tristan Wibberley)
  Re: Shared Libraries: what is the linux equivalent of "dllimport" and   "dllexport" 
(Jens-Uwe Mager)
  Re: Linking in arbitrary binary data (Peter Samuelson)
  Re: linux - java programming ([EMAIL PROTECTED])
  Re: Running 2.0.x module on 2.2.x system (Peter Samuelson)
  Re: why not C++? ("Bruce W. Bigby")

----------------------------------------------------------------------------

From: [EMAIL PROTECTED] (H. Peter Anvin)
Subject: Re: Linking in arbitrary binary data
Date: 25 Aug 1999 20:15:20 GMT
Reply-To: [EMAIL PROTECTED] (H. Peter Anvin)

Followup to:  <7q1ei0$qkg$[EMAIL PROTECTED]>
By author:    [EMAIL PROTECTED] (Jason Neudorf)
In newsgroup: comp.os.linux.development.system
>
> A while back, I asked about including arbitrary binary data in a file, ie
> putting a ".jpg" for example inside the object code itself, like a PalmPilot
> or Mac resource.  This might be useful if we need to push some code into some
> dsp or video card, or print the linux penguin at boot time.  Rather than 
> do icky transformations on an octal dump of the file in question, something
> simple can be used.
> 
> I had one perl script that generated the data automatically, but NASM has
> a nice feature that I thought was nicer.  You can write something like this:
> 

You can do this on Linux using:

        ld -r -b binary file.jpg -o file.o

It is actually better than the NASM feature, because it becomes an
independent linker object (that is not an option for NASM, since some
of its output formats, e.g. -f bin, are unlinkable.)

The only downside with the above is that there is no way (without
writing a linker script, which ends up being output-format-dependent)
to put the target in the *read-only* data section, like a "const"
object in C.  Read-only data is never kept on dirty pages.

        -hpa
-- 
<[EMAIL PROTECTED]> at work, <[EMAIL PROTECTED]> in private!

------------------------------

From: [EMAIL PROTECTED] (Peter Samuelson)
Crossposted-To: comp.security.unix
Subject: Re: PROPOSAL: A secure, simple NIS replacement
Date: 25 Aug 1999 19:13:42 -0500
Reply-To: Peter Samuelson <[EMAIL PROTECTED]>

[Rob Pope <[EMAIL PROTECTED]>]
> One of the problems with SMB though, is that it is unroutable.

Really?  Odd, it routes fine for me.  Mind, you can't necessarily rely
on the "automagic" name lookup and browse functions, but what's wrong
with DNS?

> Mind you, an IP based SMB-type system (multiple servers, browse
> lists, etc.) with something along the lines of SSH2 tunneled
> connections would be nice.

I'm having trouble understanding the difference between the feature
sets of what you propose and NIS+, which has been around for some
years.  Can you do a concept diff?

-- 
Peter Samuelson
<sampo.creighton.edu!psamuels>

------------------------------

From: "Scott Langley" <[EMAIL PROTECTED]>
Subject: Keyboard input rejected in X after upgrading to 2.3.14 kernel
Date: Wed, 25 Aug 1999 13:46:28 -0700
Reply-To: "Scott Langley" <[EMAIL PROTECTED]>

I found a weird problem.  After compiling and uprading my kernel from 2.2.11
to 2.3.14, any input from the keyboard is ignored once I login with name and
password into the desktop -- KDE, GNOME, or fvwm.  This is on a system with
Mandrake 6.0 running on an Abit BP6 motherboard.  On the first screen
available via <Crtl><Alt><F1>, there are logged many messages of:

QGDict::look: Attempt to insert null item
stdin: is not a tty

Also, I can't login to any of the other screens available via
<Crtl><Alt><FXX> keys while I'm logged into X.  (It takes the login name,
but after hitting <Enter>, it asks for the login name again.)  If I go back
to kernel 2.2.11, behavior returns to normal.  This applies to both a PS/2
and a USB keyboard.

Anyone have an idea of what's going on?

--
Scott Langley
[EMAIL PROTECTED]
http://www.scottlangley.com



------------------------------

From: "Norm Dresner" <[EMAIL PROTECTED]>
Subject: Strange mount problem
Date: 25 Aug 1999 22:08:00 GMT

The MSDOS partition of the first hard disk is mounted in fstab as
        /dev/hda1  /c  msdos   user,umode=000,rw

I have no difficulty reading or writing to this disk as root, or when a
user mounts it.  But when I mount it as root, then when a user writes
(using cp) to /c she gets a diagnostic that says
        cp:   {filename}:  Operation not permitted
but the copy operation is successful anyway!

I guess I have the following questions:
        1. What operation is not permitted on /c when it's mounted with all
permissions?
        2. Since everything seems to work when it's mounted by a user, what's the
simplest way to have the partition mounted "by a user" at boot time?

    Thanks
        Norm


------------------------------

From: Fernando Ortega Bellosta <[EMAIL PROTECTED]>
Subject: Compiler question
Date: Tue, 24 Aug 1999 19:35:30 +0200

What does it mean for the compiler something like:

void (*function)(parameters);


I found that doing this I can insert my own function (from my module) in
the kernel code, and it works.

There is an example in the file "net/ipv4/af_inet" , where the function
"rarp_ioctl_hook" from the "rarp"module is used.

but what makes it different if the functionn is not an indirect function.


If any one understand clearly this example, wolud so kind to explain it to
me.

Thanks a lot, Fernando Ortega



------------------------------

From: [EMAIL PROTECTED] (Peter Samuelson)
Subject: Re: What are difference between Monolithic kernel architecture & Microkernel 
architecture
Date: 25 Aug 1999 19:04:54 -0500
Reply-To: Peter Samuelson <[EMAIL PROTECTED]>

[Richard Lo <[EMAIL PROTECTED]>]
> I am interested in the Linux kernel. I knew the Linux kernel use
> monolithic kernel architecture. Anyway, I have no idea about
> monolithic kernel architecture and what differ from microkernel
> architecture.

You need to understand the concept of "kernel-mode" and "user-mode"
code.  On any decent CPU there are different privilege levels the CPU
can be in at a given time; on the Intel 386 series, for example, there
are four, called Ring 0 (highest) through Ring 3 (lowest).  On any
modern operating system, ordinary user code has to run in a
less-privileged state to prevent it from doing things it is not
authorized for, things like accessing arbitrary memory or arbitrary I/O
ports, or changing memory mappings.  The operating system kernel, or at
least part of it, has to run in a more-privileged state, so that it
*can* access I/O, change memory mappings, etc.  On the 386, if you're
in Ring 0 you get to define with some granularity the things that code
in the other rings can and can't do.

When user code needs to do something the CPU privilege level doesn't
allow, it must make a system call to ask the OS to do it on its behalf.
This switches the CPU from its "user mode" (Ring 3 for Linux/Intel) to
its "kernel mode" (Ring 0 for Linux/Intel).  The kernel takes over and
services the system call, then switches privilege levels back to user
mode and lets the user process continue to run.  When an I/O device or
a system timer triggers a CPU interrupt, again the CPU jumps into
kernel mode and does whatever needs to be done (schedule another
process to run, manage the I/O device, etc).

Now with a monolithic kernel design it is almost that simple.  The
entire kernel runs in kernel mode, i.e. at the higher CPU privilege
level.  With a microkernel design, on the other hand, you have a
minimal "microkernel" which runs in privileged mode, and the rest of
the OS kernel consists of "servers" which run in less-privileged modes
(whatever is needed to get the job done) and are somewhat independent
of the microkernel and of each other.  The microkernel arbitrates
between "ordinary" user processes and the kernel servers.  Servers
would include device drivers, filesystem drivers, modules for memory
management, etc.  They typically communicate with each other by use of
"message passing", that is, sending a packet of some type of
information using infrastructure provided by the microkernel.

There is much research and debate about which approach is better.
Micros have the theoretical advantage of greater separation between
components, which means it should be easier to develop and debug an
individual component, but disadvantages like the speed penalty and code
complexity of message passing.  As for Linux, Linus defends the mono
approach by noting that a well-designed and well-coded mono kernel can
really be just as modular as a microkernel.

-- 
Peter Samuelson
<sampo.creighton.edu!psamuels>

------------------------------

From: Tristan Wibberley <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.misc
Subject: Re: why not C++?
Date: Wed, 25 Aug 1999 23:52:47 +0100
Reply-To: [EMAIL PROTECTED]

On Operator overloading:

I've opened a can of worms with that extensible operator syntax - it was
only meant to be a joke :( I'm sorry.

It's academic to me anyway - If I needed that much operator use I would
use a mathematical language specifically for that use (eg compiled
matlab scripts - That would be far more useful).

-- 
Tristan Wibberley

ps, My personal preference for not overloading operators to mean
something different to their normal use holds.

------------------------------

From: "Norm Dresner" <[EMAIL PROTECTED]>
Subject: Re: Strange mount problem
Date: 25 Aug 1999 23:01:39 GMT



Miquel van Smoorenburg <[EMAIL PROTECTED]> wrote in article
<7q1r8n$kp8$[EMAIL PROTECTED]>...
> In article <01beef46$01499020$31ea4e0c@nilrem>,
> Norm Dresner <[EMAIL PROTECTED]> wrote:
> >The MSDOS partition of the first hard disk is mounted in fstab as
> >     /dev/hda1  /c  msdos   user,umode=000,rw
> >
> >I have no difficulty reading or writing to this disk as root, or when a
> >user mounts it.  But when I mount it as root, then when a user writes
> >(using cp) to /c she gets a diagnostic that says
> >     cp:   {filename}:  Operation not permitted
> >but the copy operation is successful anyway!
> >
> >I guess I have the following questions:
> >     1. What operation is not permitted on /c when it's mounted with all
> >permissions?
> 
        [SNIP]
> 
> >     2. Since everything seems to work when it's mounted by a user,
> >     what's the simplest way to have the partition mounted "by a user"
> >     at boot time?
> 
> mount -ouid=666,gid=666
> 
> Or, simply mount the partition with the "quiet" option. Read the man
> page for mount(8), it's all in there.
> 

        The quiet option works!

  Thanks
        Norm


------------------------------

From: Tristan Wibberley <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.misc
Subject: Re: why not C++?
Date: Wed, 25 Aug 1999 23:46:47 +0100
Reply-To: [EMAIL PROTECTED]

Kaz Kylheku wrote:
> 
> (Tristan must really hate that boolean
> logic notation in which + stands for OR, and multiplication represents AND.
> How unbearably arriviste!) In any case, using % for cross-product pales in
> comparison to the C++ standard library's overloads of << and >> for input and
> output side effects.

I don't mind that boolean one - it works mathematically when combining
simple probabilities :) but the others I hate - I generally prefer to
not use operators past simple arithmetical operations - I can never
remember precedence so I have to look it up all the time :/ One day I'll
be able to remember - I'm reading a book on memory enhancing specially.

Fair point about which product * should represent though.

-- 
Tristan Wibberley

------------------------------

From: Eric Hegstrom <[EMAIL PROTECTED]>
Crossposted-To: 
comp.os.linux.development.apps,comp.os.linux.misc,de.comp.os.linux,jaring.os.linux
Subject: Re: Bypass Login
Date: Wed, 25 Aug 1999 16:06:11 -0700

Yes, it is very strange indeed. I do in fact create a proper home
directory for my userName user (let's just call him "CS" since that
really is it's name).

Here's the reproduction steps. I set it up in my inittab to do the
mingetty for tty2-6 (remove it for 1 for obvious reasons) then do "su
--login CS".

So now we boot up nicely into ~CS (/home/CS) but I get an Authentication
fails (I believe it may be an _X11TransSocketINET Connect error=111 ).
But if I switch to another tty by doing the cntrl/alt/f2 and log in as
CS (with the password) then I can do a startx just fine. I can even
terminate that X session and go back and try it from the su'ed session
and it stiull fails (though you would think it may try to use the
.Xauthority stuff again). The .Xauthority file gets written when it
works. I have yet to go through it yet.

right now I am just booting up into a root account (su --login root) and
it seems to pass authentication.

Thanks for the help so far.

Cheers,
Eric

 
Tristan Wibberley wrote:
> 
> Eric Hegstrom wrote:
> >
> > The only problem I am running into with this method is that my X client
> > claims "Authentication fails" when I try to connect to it when my
> > account is started using "su --login userName". If I go through the
> > normal mingetty login everything is OK. Does anyone know how to address
> > this. Should I be using the .Xauthority file created when I did the
> > sucessful xinit from the mingetty login. I have looked at the Xsecurity
> > manpage bu t obviously have not analyzed it in depth.
> >
> > Any suggestions would be very appreciated.
> 
> su --login is *supposed* to do everything that happens with login isn't
> it. Hmm, is the group set correctly with su?
> 
> Ah, Hangon. .Xauthority is created in ~userName. Make sure you have a
> home directory for that user.
> 
> --
> Tristan Wibberley

-- 
Eric Hegstrom                          .~.
Senior Software Engineer               /V\  
Sonoran Scanners, Inc.                // \\          L I N U X
[EMAIL PROTECTED]        /(   )\  >don't fear the penguin<
520-617-0072 x402                     ^^-^^

------------------------------

From: [EMAIL PROTECTED] (Kaz Kylheku)
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.misc
Subject: Re: why not C++?
Date: Thu, 26 Aug 1999 00:52:42 GMT

On Wed, 25 Aug 1999 20:48:52 -0400, Bruce W. Bigby <[EMAIL PROTECTED]>
wrote:
>directly throughout their code. You can write a whole object-oriented
>system in C, if you have the inclination with single-inheritance and do
>it efficiently. I've done it. :-)

I've done  multiple *interface* inheritance in C without too many difficulties.
Structured exception handling too.  :)

------------------------------

From: "Bruce W. Bigby" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.misc
Subject: Re: why not C++?
Date: Wed, 25 Aug 1999 21:16:30 -0400

"Bruce W. Bigby" wrote:
> 
> Kaz Kylheku wrote:
> >
> > On Wed, 25 Aug 1999 20:48:52 -0400, Bruce W. Bigby <[EMAIL PROTECTED]>
> > wrote:
> > >directly throughout their code. You can write a whole object-oriented
> > >system in C, if you have the inclination with single-inheritance and do
> > >it efficiently. I've done it. :-)
> >
> > I've done  multiple *interface* inheritance in C without too many difficulties.
> > Structured exception handling too.  :)
> 

Oh, I thought you said "multiple inheritance". I agree that multiple
"interface" is definitely doable. I thought about adding that to my
efforts as well. Sometimes, I think that it would be cool to join our
efforts and come up with a new kind of libc (not to replace libc), but
create an object-oriented system in C which is copylefted but enables C
programmers to develop object-oriented code in C.

-- 
Bruce W. Bigby
http://home.rochester.rr.com/bigbyofrocny
Do for others what you would want others to do for you.

------------------------------

Date: Wed, 25 Aug 1999 23:57:35 +0000
From: Robert Lynch <[EMAIL PROTECTED]>
Crossposted-To: 
comp.os.linux.development.apps,comp.os.linux.misc,de.comp.os.linux,jaring.os.linux
Subject: Re: Bypass Login

Eric Hegstrom wrote:
> 
> The only problem I am running into with this method is that my X client
> claims "Authentication fails" when I try to connect to it when my
> account is started using "su --login userName". If I go through the
> normal mingetty login everything is OK. Does anyone know how to address
> this. Should I be using the .Xauthority file created when I did the
> sucessful xinit from the mingetty login. I have looked at the Xsecurity
> manpage bu t obviously have not analyzed it in depth.
> 
> Any suggestions would be very appreciated.
> 
> Cheers,
> Eric

You could use Kodis' "autologin", see the Linux Gazette article or my
copy on:

ftp://shell3.ba.best.com/pub/rmlynch/RPMS/kodis.txt

If you're not into rolling your own, I put together some rpm's that
install
the necessary stuff:

ftp://shell3.ba.best.com/pub/rmlynch/RPMS/mingetty+autologin-0.9.4-1.i386.rpm

ftp://shell3.ba.best.com/pub/rmlynch/RPMS/mingetty+autologin-0.9.4-1.src.rpm

Unfortunately, I couldn't figure out how to REALLY do it, so you have to
force the install (I've got to revisit that thingie some day and fix
it.)

I use it to get a no-login VT1 on my own box, it's cool IMO.

At the bottom of Kodis' article he gives a script that runs X, but I
don't use it with autologin, so you're on your own.

The whole scheme is designed to allow autologin, which is why it is
called this, surprise!

Bob L.
-- 
Robert Lynch-Berkeley CA [EMAIL PROTECTED]
http://www.best.com/~rmlynch/

------------------------------

From: Tristan Wibberley <[EMAIL PROTECTED]>
Crossposted-To: 
comp.os.linux.development.apps,comp.os.linux.misc,de.comp.os.linux,jaring.os.linux
Subject: Re: Bypass Login
Date: Thu, 26 Aug 1999 01:37:35 +0100
Reply-To: [EMAIL PROTECTED]

Eric Hegstrom wrote:
> 
> Yes, it is very strange indeed. I do in fact create a proper home
> directory for my userName user (let's just call him "CS" since that
> really is it's name).
> 
> Here's the reproduction steps. I set it up in my inittab to do the
> mingetty for tty2-6 (remove it for 1 for obvious reasons) then do "su
> --login CS".
> 
> So now we boot up nicely into ~CS (/home/CS) but I get an Authentication
> fails (I believe it may be an _X11TransSocketINET Connect error=111 ).
> But if I switch to another tty by doing the cntrl/alt/f2 and log in as
> CS (with the password) then I can do a startx just fine. I can even
> terminate that X session and go back and try it from the su'ed session
> and it stiull fails (though you would think it may try to use the
> .Xauthority stuff again). The .Xauthority file gets written when it
> works. I have yet to go through it yet.
> 
> right now I am just booting up into a root account (su --login root) and
> it seems to pass authentication.

Hmm, this is puzzling. Maybe the environment isn't being set up
correctly - and the X server doesn't mind if you are root, but does if
you aren't (I've never actually done this autologin with an X server).

Remove startx and exit from .bashrc so you drop into an inveractive
shell and do (with CS autologin):

  env > autologin_environment

Then switch to a different VT to do a standard login as CS and do:

  env | diff - autologin_environment > env.diff

and post the env.diff file and we can see what differences there are
that there shouldn't be (if any).

-- 
Tristan Wibberley

------------------------------

From: [EMAIL PROTECTED] (Jens-Uwe Mager)
Crossposted-To: comp.os.linux.development.apps
Subject: Re: Shared Libraries: what is the linux equivalent of "dllimport" and   
"dllexport"
Date: 26 Aug 1999 00:12:39 GMT

On 23 Aug 1999 20:58:17 +0200, Peter Mutsaers <[EMAIL PROTECTED]> wrote:
>>> "BP" == Brian Poe <[EMAIL PROTECTED]> writes:
>
>    BP> Under VC++ in Win32, the lack of __declspec(dllexport) indeed
>    BP> does remove the function symbol from the dll.
>
>AIX has a similar thing with its shared libraries: you have to list
>every symbol that you intend to export. Personally I think that is a
>horror.

It works very nicely, and it avoids the name space pollution you get
otherwise. Fortunately the HP-UX and IRIX linkers are able to do that
as well. With larger libraries you simply cannot avoid global symbols
so it is nice if you can hide them. It also helps finding if someone
does use functions outside of the defined API, this would help with
problems like these that showed up with the glibc 2.0 to 2.1 transition.

-- 
Jens-Uwe Mager  <pgp-mailto:62CFDB25>

------------------------------

From: [EMAIL PROTECTED] (Peter Samuelson)
Subject: Re: Linking in arbitrary binary data
Date: 25 Aug 1999 20:38:47 -0500
Reply-To: Peter Samuelson <[EMAIL PROTECTED]>


  [Jason Neudorf <[EMAIL PROTECTED]>]
> > I had one perl script that generated the data automatically, but
> > NASM has a nice feature that I thought was nicer.

The Perl solution works fine for me.  Actually this is what Cheesy
Shell Hacks [tm] are for.  Untested:

  #!/bin/sh
  # usage: ./bin2c SYMBOLNAME < foo.bin > foo.h
  echo "const char $1 [] = { /* Automatically generated, DO NOT EDIT */"
  # I think this requires the GNU textutils version of od
  od -An -tx1 -v -w16 | sed -e 's/ /, /g' -e 's/$/,/' -e 's/^/  /'
  echo "};"

If you need more portability, use fewer od options at the expense of
more sedation.  If you need the file size, add a temp file or just use
sizeof(SYMBOLNAME) in the C program.

[H. Peter Anvin <[EMAIL PROTECTED]>]
>       ld -r -b binary file.jpg -o file.o

Great, but is there a way to control the symbol names, other than
symlinking the input file?

-- 
Peter Samuelson
<sampo.creighton.edu!psamuels>

------------------------------

Crossposted-To: comp.os.linux.hardware,redhat.kernel.general
From: [EMAIL PROTECTED]
Subject: Re: linux - java programming
Reply-To: [EMAIL PROTECTED]
Date: Thu, 26 Aug 1999 01:51:29 GMT

In <[EMAIL PROTECTED]>, nigel <[EMAIL PROTECTED]> writes:
>How do I contain linux and a java program in a flashdisk of 16Mbytes. It is 
>
>a embedded system having a memory of 16 Mbytes.
>
>
I can't answer this at this time.  I'm pursuing the disk footprint for Java and 
Linux with an application with the possibility of a 16M flashdisk.


>
>What are required for a java program to run in linux environment in this 
>
>embedded system?
>
> 
A JVM will be required.  I'm aware of two JVM's, Blackdown and IBM, for Linux.
Either should work.

>
>How do I read and write to a printer port? What are involved in the 
>
>process, as in how the kernel access the printer port and how a java 
>
>program can read and write to a printer port?
>
>
Serial and parallel ports (and someday USB) can be accessed using javax.comm.
It takes a little kludging in the Linux world but it can be done.  Parallel support 
may not be complete yet.  This requires the comm.jar file from Sun for Sparc 
Solaris along with RXTX for Linux.  RXTX is the glue between javax.comm and 
Linux.  With these pieces properly installed the serial ports (and maybe parallel) 
can be accessed by a Java application.  Of course one could use JNI also, but 
javax.comm is the prefered means since the code should be portable across 
platforms.

>
>What is the relationship of the java program and the kernel to accomplish 
>
>that?
>

The Java program is byte code that is interpreted by the JVM.  The JVM 
interfaces with the OS.

>------------------  Posted via CNET Linux Help  ------------------
>                    http://www.searchlinux.com


------------------------------

From: [EMAIL PROTECTED] (Peter Samuelson)
Subject: Re: Running 2.0.x module on 2.2.x system
Date: 25 Aug 1999 19:23:49 -0500
Reply-To: Peter Samuelson <[EMAIL PROTECTED]>

[Hugh Sparks <[EMAIL PROTECTED]>]
> I have a commercial driver module that works with the 2.0.x kernels
> but not with 2.2.x. The vendor has apparently lost interest in Linux.

Then you can't upgrade to 2.2.  Nobody (AFAIK) has written any kind of
wrapper between the 2.0 and 2.2 module interfaces.  It would be very
difficult because of some fundamental things which have changed between 
the two.

> An unattractive alternative would be disassembly & repair...

Would this violate your license agreement?  Many shrink-wrap licenses
specifically forbit decompilation/disassembly.

> Suggestions? Derision?

Sorry, but you knew you were running this risk when you chose a vendor
that didn't provide source code.

-- 
Peter Samuelson
<sampo.creighton.edu!psamuels>

------------------------------

From: "Bruce W. Bigby" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.misc
Subject: Re: why not C++?
Date: Wed, 25 Aug 1999 21:13:58 -0400

Kaz Kylheku wrote:
> 
> On Wed, 25 Aug 1999 20:48:52 -0400, Bruce W. Bigby <[EMAIL PROTECTED]>
> wrote:
> >directly throughout their code. You can write a whole object-oriented
> >system in C, if you have the inclination with single-inheritance and do
> >it efficiently. I've done it. :-)
> 
> I've done  multiple *interface* inheritance in C without too many difficulties.
> Structured exception handling too.  :)

Yes, I wrote an exception-handler for C and wrote an article about it in
the November 1998 issue of Dr. Dobb's Journal. I all it GEF for the
General Exception-Handling Facility. GEF supports the concept of
Design-by-Contract, as well--like Eiffel. For example,

double
SquareRoot(double x) {
   double answer;
   gef_try {
      answer = sqrt(double x);
   } gef_preconditions {
      gef_assert(x >= 0);
   } gef_postconditions {
      gef_assert(fabs(answer * answer - x) <= 0.001);
   } gef_end;
   return(answer);
}

GEF also supports UNIX signals and pthreads. There is a basic gef_ansi
library, a gef_posix library, and a gef_pthreads library.

For class-related stuff, GEF also supports an gef_invariants block.

As for the multiple inheritance, I decided to do only single
inheritance, since dispatching to the appropriate method would be fast
-- nothing more than accessing a function in an array, just like in the
early C++ compilers. I don't believe that this is possible with multiple
inheritance, but you can prove me wrong. I'm always open to learning.
-- 
Bruce W. Bigby
http://home.rochester.rr.com/bigbyofrocny
Do for others what you would want others to do for you.

------------------------------


** FOR YOUR REFERENCE **

The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:

    Internet: [EMAIL PROTECTED]

You can send mail to the entire list (and comp.os.linux.development.system) via:

    Internet: [EMAIL PROTECTED]

Linux may be obtained via one of these FTP sites:
    ftp.funet.fi                                pub/Linux
    tsx-11.mit.edu                              pub/linux
    sunsite.unc.edu                             pub/Linux

End of Linux-Development-System Digest
******************************

Reply via email to