Linux-Advocacy Digest #600, Volume #33 Sat, 14 Apr 01 06:13:03 EDT
Contents:
Re: To Eric FunkenBush ("Kelsey Bjarnason")
Re: Something cool in gcc ("Kelsey Bjarnason")
Re: So much for modules in Linux! ("Tom Wilson")
Re: Windoze is dying.... (pip)
Re: lack of linux billionaires explained in one easy message (Marada C. Shradrakaii)
Re: NT is stagnant while Linux explodes ("Kelsey Bjarnason")
Re: So much for modules in Linux! ("Tom Wilson")
Re: So much for modules in Linux! ("Tom Wilson")
----------------------------------------------------------------------------
From: "Kelsey Bjarnason" <[EMAIL PROTECTED]>
Subject: Re: To Eric FunkenBush
Date: Sat, 14 Apr 2001 09:10:04 GMT
Assuming the code at the bottom is unmodifed from the one causing
problems...
(created project test.junk, added all the files to it, hit F7 and...)
====================Configuration: junk = Win32 Debug====================
Compiling...
workmi.cpp
strng2.cpp
workermi.cpp
Linking...
junk.exe - 0 error(s), 0 warning(s)
"JLI" <[EMAIL PROTECTED]> wrote in message
news:LjOB6.8860$[EMAIL PROTECTED]...
> You should at least say where in your source code caused the error instead
> of letting
> other people to read through your 5 or 6 files. This way you can save some
> time.
>
>
>
> JLI
>
> GreyCloud <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]...
> > I've found the programs in the book "C++ Primer Plus" by Stephen Prata.
> >
> > See attached source code.
> >
> > Under VC++6.0 7 errors were reported as C2448. The variable str could
> > not access a private part in a class.
> >
> > Under g++ the program compiled fine. The program runs fine.
> > I'm using 2.95.2 version of Gnu C.
> >
> > I used "g++ -o workmi workmi.cpp workermi.cpp strng2.cpp"
> >
> > It appears that VC++ can not handle the code properly. After all this
> > program did come from a the MITCHELL WAITE Series.
>
>
> --------------------------------------------------------------------------
--
> ----
>
>
> > file://arraytp.h -- Array Template
> > #include <iostream>
> > using namespace std;
> > #include <cstdlib>
> >
> > template <class T, int n>
> > class ArrayTP
> > {
> > private:
> > T ar[n];
> > public:
> > ArrayTP();
> > explicit ArrayTP(const T & v);
> > virtual T & operator[](int i);
> > virtual const T & operator[](int i) const;
> > };
> >
> > template <class T, int n>
> > ArrayTP<T,n>::ArrayTP()
> > {
> > for (int i = 0; i < n; i++)
> > ar[i] = 0;
> > }
> >
> > template <class T, int n>
> > ArrayTP<T,n>::ArrayTP(const T & v)
> > {
> > for (int i = 0; i < n; i++)
> > ar[i] = v;
> > }
> >
> > template <class T, int n>
> > T & ArrayTP<T,n>::operator[](int i)
> > {
> > if (i < 0 || i >= n)
> > {
> > cerr << "Error in array limits: " << i
> > << " is out of range\n";
> > exit(1);
> > }
> > return ar[i];
> > }
> >
> > template <class T, int n>
> > const T & ArrayTP<T,n>::operator[](int i) const
> > {
> > if (i < 0 || i >= n)
> > {
> > cerr << "Error in array limits: " << i
> > << " is out of range\n";
> > exit(1);
> > }
> > return ar[i];
> > }
> >
>
>
> --------------------------------------------------------------------------
--
> ----
>
>
> > // strng2.cpp -- String class methods
> > #include <iostream>
> > #include <cstring>
> > using namespace std;
> > #include "strng2.h"
> >
> > // class methods
> >
> > String::String(const char * s) // make String from C string
> > {
> > len = strlen(s);
> > str = new char[len + 1]; // allot storage
> > strcpy(str, s); // initialize pointer
> > }
> >
> > String::String() // default constructor
> > {
> > len = 0;
> > str = new char[1];
> > str[0] = '\0'; // default string
> > }
> >
> > String::String(const String & st) // copy constructor
> > {
> > len = st.len;
> > str = new char[len + 1];
> > strcpy(str, st.str);
> > }
> >
> > String::~String() // destructor
> > {
> > delete [] str; // required
> > }
> >
> > // assign a String to a String
> > String & String::operator=(const String & st)
> > {
> > if (this == &st)
> > return *this;
> > delete [] str;
> > len = st.len;
> > str = new char[len + 1];
> > strcpy(str, st.str);
> > return *this;
> > }
> >
> > // assign a C string to a String
> > String & String::operator=(const char * s)
> > {
> > delete [] str;
> > len = strlen(s);
> > str = new char[len + 1];
> > strcpy(str, s);
> > return *this;
> > }
> >
> > // true if st1 follows st2 in collating sequence
> > bool operator>(const String &st1, const String &st2)
> > {
> > if (strcmp(st1.str, st2.str) > 0)
> > return true;
> > else
> > return false;
> > }
> >
> > // true if st1 precedes st2 in collating sequence
> > bool operator<(const String &st1, const String &st2)
> > {
> > if (strcmp(st1.str, st2.str) < 0)
> > return true;
> > else
> > return false;
> > }
> >
> > // friends
> > // true if st1 is the same as st2
> > bool operator==(const String &st1, const String &st2)
> > {
> > if (strcmp(st1.str, st2.str) == 0)
> > return true;
> > else
> > return false;
> > }
> >
> > // display string
> > ostream & operator<<(ostream & os, const String & st)
> > {
> > os << st.str;
> > return os;
> > }
> >
> > // quick and dirty String input
> > istream & operator>>(istream & is, String & st)
> > {
> > char temp[80];
> > is.get(temp, 80);
> > if (is)
> > st = temp;
> > while (is && is.get() != '\n')
> > continue;
> > return is;
> > }
> >
>
>
> --------------------------------------------------------------------------
--
> ----
>
>
> > // strng2.h -- String class definition
> > #ifndef _STRNG2_H_
> > #define _STRNG2_H_
> > #include <iostream>
> > using namespace std;
> >
> > class String
> > {
> > private:
> > char * str; // pointer to string
> > int len; // length of string
> > public:
> > String(const char * s); // constructor
> > String(); // default constructor
> > String(const String & st);
> > ~String(); // destructor
> > int length() const { return len; }
> > // overloaded operators
> > String & operator=(const String & st); // Assignment operator
> > String & operator=(const char * s); // Assignment operator #2
> > // friend functions
> > friend bool operator>(const String &st1, const String &st2);
> > friend bool operator<(const String &st, const String &st2);
> > friend bool operator==(const String &st, const String &st2);
> > friend ostream & operator<<(ostream & os, const String & st);
> > friend istream & operator>>(istream & is, String & st);
> > };
> > #endif
> >
>
>
> --------------------------------------------------------------------------
--
> ----
>
>
> > // workermi.cpp -- working class methods with MI
> > #include "workermi.h"
> > #include <iostream>
> > using namespace std;
> > // Worker methods
> > Worker::~Worker() { }
> >
> > // protected methods
> > void Worker::Data() const
> > {
> > cout << "Name: " << fullname << "\n";
> > cout << "Employee ID: " << id << "\n";
> > }
> >
> > void Worker::Get()
> > {
> > cin >> fullname;
> > cout << "Enter worker's ID: ";
> > cin >> id;
> > while (cin.get() != '\n')
> > continue;
> > }
> >
> > // Waiter methods
> > void Waiter::Set()
> > {
> > cout << "Enter waiter's name: ";
> > Worker::Get();
> > Get();
> > }
> >
> > void Waiter::Show() const
> > {
> > cout << "Category: waiter\n";
> > Worker::Data();
> > Data();
> > }
> >
> > // protected methods
> > void Waiter::Data() const
> > {
> > cout << "Panache rating: " << panache << "\n";
> > }
> >
> > void Waiter::Get()
> > {
> > cout << "Enter waiter's panache rating: ";
> > cin >> panache;
> > while (cin.get() != '\n')
> > continue;
> > }
> >
> > // Singer methods
> >
> > char * Singer::pv[Singer::Vtypes] = {"other", "alto", "contralto",
> > "soprano", "bass", "baritone", "tenor"};
> >
> > void Singer::Set()
> > {
> > cout << "Enter singer's name: ";
> > Worker::Get();
> > Get();
> > }
> >
> > void Singer::Show() const
> > {
> > cout << "Category: singer\n";
> > Worker::Data();
> > Data();
> > }
> >
> > // protected methods
> > void Singer::Data() const
> > {
> > cout << "Vocal range: " << pv[voice] << "\n";
> > }
> >
> > void Singer::Get()
> > {
> > cout << "Enter number for singer's vocal range:\n";
> > int i;
> > for (i = 0; i < Vtypes; i++)
> > {
> > cout << i << ": " << pv[i] << " ";
> > if (i % 4 == 3)
> > cout << '\n';
> > }
> > if (i % 4 != 0)
> > cout << '\n';
> > cin >> voice;
> > while (cin.get() != '\n')
> > continue;
> > }
> >
> > // SingingWaiter methods
> > void SingingWaiter::Data() const
> > {
> > Singer::Data();
> > Waiter::Data();
> > }
> >
> > void SingingWaiter::Get()
> > {
> > Waiter::Get();
> > Singer::Get();
> > }
> >
> > void SingingWaiter::Set()
> > {
> > cout << "Enter singing waiter's name: ";
> > Worker::Get();
> > Get();
> > }
> >
> > void SingingWaiter::Show() const
> > {
> > cout << "Category: singing waiter\n";
> > Worker::Data();
> > Data();
> > }
> >
>
>
> --------------------------------------------------------------------------
--
> ----
>
>
> > // workermi.h -- working classes with MI
> > #include "strng2.h"
> >
> > class Worker // an abstract base class
> > {
> > private:
> > String fullname;
> > long id;
> > protected:
> > virtual void Data() const;
> > virtual void Get();
> > public:
> > Worker() : fullname("no one"), id(0L) {}
> > Worker(const String & s, long n)
> > : fullname(s), id(n) {}
> > virtual ~Worker() = 0; // pure virtual function
> > virtual void Set() = 0;
> > virtual void Show() const = 0;
> > };
> >
> > class Waiter : virtual public Worker
> > {
> > private:
> > int panache;
> > protected:
> > void Data() const;
> > void Get();
> > public:
> > Waiter() : Worker(), panache(0) {}
> > Waiter(const String & s, long n, int p = 0)
> > : Worker(s, n), panache(p) {}
> > Waiter(const Worker & wk, int p = 0)
> > : Worker(wk), panache(p) {}
> > void Set();
> > void Show() const;
> > };
> >
> > class Singer : virtual public Worker
> > {
> > protected:
> > enum {other, alto, contralto, soprano,
> > bass, baritone, tenor};
> > enum {Vtypes = 7};
> > void Data() const;
> > void Get();
> > private:
> > static char *pv[Vtypes]; // string equivs of voice types
> > int voice;
> > public:
> > Singer() : Worker(), voice(other) {}
> > Singer(const String & s, long n, int v = other)
> > : Worker(s, n), voice(v) {}
> > Singer(const Worker & wk, int v = other)
> > : Worker(wk), voice(v) {}
> > void Set();
> > void Show() const;
> > };
> >
> > // multiple inheritance
> > class SingingWaiter : public Singer, public Waiter
> > {
> > protected:
> > void Data() const;
> > void Get();
> > public:
> > SingingWaiter() {}
> > SingingWaiter(const String & s, long n, int p = 0,
> > int v = Singer::other)
> > : Worker(s,n), Waiter(s, n, p), Singer(s, n, v) {}
> > SingingWaiter(const Worker & wk, int p = 0, int v = Singer::other)
> > : Worker(wk), Waiter(wk,p), Singer(wk,v) {}
> > SingingWaiter(const Waiter & wt, int v = other)
> > : Worker(wt),Waiter(wt), Singer(wt,v) {}
> > SingingWaiter(const Singer & wt, int p = 0)
> > : Worker(wt),Waiter(wt,p), Singer(wt) {}
> > void Set();
> > void Show() const;
> > };
> >
>
>
> --------------------------------------------------------------------------
--
> ----
>
>
> > // workmi.cpp -- multiple inheritance
> > // compile with workermi.cpp, strng2.cpp
> > #include <iostream>
> > using namespace std;
> > #include <cstring>
> > #include "workermi.h"
> > #include "arraytp.h" // omit if no template support
> > const int SIZE = 5;
> >
> > int main()
> > {
> > ArrayTP<Worker *, SIZE> lolas;
> > // if no template support, omit the above and use the following:
> > // Worker * lolas[SIZE];
> >
> > int ct;
> > for (ct = 0; ct < SIZE; ct++)
> > {
> > char choice;
> > cout << "Enter the employee category:\n"
> > << "w: waiter s: singer "
> > << "t: singing waiter q: quit\n";
> > cin >> choice;
> > while (strchr("ewstq", choice) == NULL)
> > {
> > cout << "Please enter a, w, s, t, or q: ";
> > cin >> choice;
> > }
> > if (choice == 'q')
> > break;
> > switch(choice)
> > {
> > case 'w': lolas[ct] = new Waiter;
> > break;
> > case 's': lolas[ct] = new Singer;
> > break;
> > case 't': lolas[ct] = new SingingWaiter;
> > break;
> > }
> > cin.get();
> > lolas[ct]->Set();
> > }
> >
> > cout << "\nHere is your staff:\n";
> > int i;
> >
> > for (i = 0; i < ct; i++)
> > {
> > cout << '\n';
> > lolas[i]->Show();
> > }
> > for (i = 0; i < ct; i++)
> > delete lolas[i];
> > return 0;
> > }
> >
>
>
------------------------------
From: "Kelsey Bjarnason" <[EMAIL PROTECTED]>
Subject: Re: Something cool in gcc
Date: Sat, 14 Apr 2001 09:14:15 GMT
"Erik Funkenbusch" <[EMAIL PROTECTED]> wrote in message
news:RCTB6.3184$[EMAIL PROTECTED]...
> "mlw" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]...
> > I did something in gcc, that I thought would make the compiler barf, to
> prove a
> > point. Instead of proving my point it would not work, it worked. Wow!
this
> is a
> > great feature of gcc.
> >
> > 1 #include <unistd.h>
> > 2 #include <string.h>
> > 3 #include <stdio.h>
> > 4 void function(char *str1, char *str2)
> > 5 {
> > 6 int cb = strlen(str1)+strlen(str2)+1;
> > 7 char str[cb];
> > 8 strcpy(str,str1);
> > 9 strcat(str,str2);
> > 10 printf("%s\n", str);
> > 11 }
> >
> > It isn't standard C/C++ but it could certainly save a malloc or two here
> and
> > there.
>
> You think it's cool that a compiler violates the C++ standard without even
a
> warning? What if you're trying to write compliant code?
Then you should know what you're doing. For example, you can use any of
1,000 types of undefined behaviour, and not only isn't the compiler required
to warn you, in many cases it is not _possible_ to warn you. Compiler
diagnostics are no replacement for a human's ability to think about what
they're doing.
> In any event, I think this may be an optimization. C++ allows you to use
> constant variables as array declarations, since you're not changing the
> value of cb, it is probably optimizing it to a const value.
Or it was actually compiled as C code and gcc is trying to support C99
features. Note the OP said "C/C++" - some mythical language nobody's ever
heard of - but it sure as hell _looks_ like C code, not C++ code.
------------------------------
From: "Tom Wilson" <[EMAIL PROTECTED]>
Subject: Re: So much for modules in Linux!
Date: Sat, 14 Apr 2001 09:28:56 GMT
"Pete Goodwin" <[EMAIL PROTECTED]> wrote in message
news:rwxB6.13898$[EMAIL PROTECTED]...
> Roy Culley wrote:
>
> > Until recently I used SuSE Linux exclusively. I only had a static IP
> > address conection at that time so never used SuSE with DHCP. I cannot
> > believe that YAST doesn't know how to setup an interface for DHCP. In
> > fact I don't believe it. SuSE users should never need to worry about
> > startup scripts at all unless they are working with things that aren't
> > a part of a standard SuSE system.
>
> I cannot believe a Linux distribution would release something that mangles
> the drivers for two network cards because it loads DHCP or a firewall
> first. That's SuSE for you.
>
> > Well that is patently clear. Does his employer know this. :-)
>
> Obviously not. Otherwise they wouldn't give me a 20% pay rise.
The "Peter Principle" in action no doubt. <g>
------------------------------
From: pip <[EMAIL PROTECTED]>
Subject: Re: Windoze is dying....
Date: Sat, 14 Apr 2001 10:30:24 +0100
Ray Chason wrote:
>
> http://slashdot.org/article.pl?sid=01/04/13/1236215&mode=thread
>
> Well, well, well. It seems the almighty Redmond Empire can't get
> its Xbox out on time.
>
> Guess Windoze must be dying.
Has any software company shipped *anything* on time ever in the life of
computing history?
I don't think you'll find XBox won't be shipping.
Talking about games - it's a real shame that more new games are not
released in parallel under Linux. I've just got "Black & White", the new
LionHead game. What a FANTASTIC game so far! The graphics are wonderful
and the AI is second to none! Anyway the annoying thing is that my win
boxen would not run it at a decent speed so I had to install the horror
OS on my unspoiled new Linux box in order to play this wonder of
programming. Annoying, but worth it. btw it took LionHead three years to
craft their masterpiece - perfection takes time (of course I doubt
anyone would claim that delays at Mafia$oft were due to perfection).
------------------------------
From: [EMAIL PROTECTED] (Marada C. Shradrakaii)
Date: 14 Apr 2001 09:36:24 GMT
Subject: Re: lack of linux billionaires explained in one easy message
>Do the math:
>in 3 x 18 months, or 4.5 years, it will cost about 8 times less
>to buy a computer than it costs today.
Not quite. Moore's law doesn't handle everything. The transistors may double,
but you still have to pay for the packaging, the circuit boards, the lowtech
powersupplies and cases, the drives, and such that doesn't cheapen at the same
rate.
Also, there's the problem that there's a floor on what gets sold new in
quantity. Rather than sell CPUs for $7 a piece, they'll just phase out the
speed grade, or the processor class as a whole.
--
Marada Coeurfuege Shra'drakaii
Colony name not needed in address.
------------------------------
From: "Kelsey Bjarnason" <[EMAIL PROTECTED]>
Crossposted-To: alt.destroy.microsoft,comp.os.ms-windows.advocacy
Subject: Re: NT is stagnant while Linux explodes
Date: Sat, 14 Apr 2001 09:41:38 GMT
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]...
> In article <9b3a03$5cb$[EMAIL PROTECTED]>,
> "Todd" <todd<remove>[EMAIL PROTECTED]> writes:
> >
> > "667 Neighbor of the Beast" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]...
> >
> >> If with that built-in guarantee, they still cannot cut it. Linux's
> >> momentum is astounding; NT's is basically flat!
> >
> > This is true, however. Linux is able to take hold where the cost of the
OS
> > is significant. For most big corporations, the cost of the OS is small
in
> > comparison to labor costs...
>
> TCO for any Unix is small compared to Windows (what an absurd name for
server
> systems). Last year alone there were over 100 security bugs found in
Microsoft
> SW. The worst offender was IIS. Windows admins just can't keep up. Each
new
> service pack introduces yet more bugs. The number of security bugs found
in
> Unix systems is tiny compared to Microsoft and patches are normally made
> available far faster than patches from Microsoft.
The number of bugs _found_ is less than in Windows... but is the number of
bugs that _exist_ less? What are the comparitive number of Unix systems
(server and client) in use compared to the number of Windows systems (server
and client) in use? Doesn't Windows clock in with just a few more
installations?
This strikes me as akin to the argument "Since New York had 8 murders last
year, but Podunk only had 2, Podunk is safer" - ignoring the niggling little
detail that Podunk, having a population of 2,000 compared to New York's 8
million, makes it 1,000 times *more* likely you'll get murdered in Podunk.
------------------------------
From: "Tom Wilson" <[EMAIL PROTECTED]>
Subject: Re: So much for modules in Linux!
Date: Sat, 14 Apr 2001 09:42:27 GMT
"Matthew Gardiner" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> Well, hopefully this development will finally make developers realise
> that there is potential in Linux instead of dismissing it as some fad,
> mind you, something that has lasted 10 years I would not consider a
> fad. As a side note, I find it rather funny that developers bitch and
> moan because of the lack of gaming API's when they totally over look
> OpenGL, and its audio equivilant, OpenAL. There is also sdl used by
> lokigames to help them port many of the DirectX based games to linux. I
> am sure there are many other API's out there for Linux, so, as a matter
> of fact, they not only have a gaming API, but a selection, so that, if
> API "X" doesn't suite the job, then they can use one that does.
>
> As for SuSE Linux. I have SuSE Linux 7.1 running, and compared to
> Redhat, SuSE is awsome. Hence, the reason I donot understand why SuSE
> has not made bigger inroads into the US market.
It's absence on store shelves had a lot to do with it, I'm sure. That's
changing though. I picked up mine from OfficeMax a while back. (And, without
a doubt, Red Hat could take some lessons from them. Fantastic distro!)
--
Tom Wilson
------------------------------
From: "Tom Wilson" <[EMAIL PROTECTED]>
Subject: Re: So much for modules in Linux!
Date: Sat, 14 Apr 2001 09:51:16 GMT
"Pete Goodwin" <[EMAIL PROTECTED]> wrote in message
news:d%RB6.16566$[EMAIL PROTECTED]...
> Matthew Gardiner wrote:
>
> > Well, hopefully this development will finally make developers realise
> > that there is potential in Linux instead of dismissing it as some fad,
> > mind you, something that has lasted 10 years I would not consider a
> > fad. As a side note, I find it rather funny that developers bitch and
> > moan because of the lack of gaming API's when they totally over look
> > OpenGL, and its audio equivilant, OpenAL. There is also sdl used by
> > lokigames to help them port many of the DirectX based games to linux. I
> > am sure there are many other API's out there for Linux, so, as a matter
> > of fact, they not only have a gaming API, but a selection, so that, if
> > API "X" doesn't suite the job, then they can use one that does.
>
> There is potential but...
>
> Being technologically better or more stable or (pick your favourite
> attribute here) is irrelevant as to whether you will succeed or not.
>
> It's all about marketing. It's not about technology. Microsoft has the
> muscle to make Windows succeed and is doing that rather successfully.
Linux
> has no such muscle. And guess what, Linux is hardly anywhere on the
desktop.
>
> > As for SuSE Linux. I have SuSE Linux 7.1 running, and compared to
> > Redhat, SuSE is awsome. Hence, the reason I donot understand why SuSE
> > has not made bigger inroads into the US market. About the only bone I
> > have to pick with SuSE is the number of duplicate packages, such as
> > having three Java Virtual Machines, when one would be adequate.
>
> Sadly, it's probably not making such big inroads because it's not
American.
It's availability on store shelves, or lack thereof, was the big problem.
The "Buy American" thing is a non-issue since everything on store shelves in
made in China anyway<g>. As previously mentioned, SuSE is starting to catch
on. Good thing too! Beats Red Hat handily.
--
Tom Wilson
------------------------------
** 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 by posting to comp.os.linux.advocacy.
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-Advocacy Digest
******************************