Linux-Advocacy Digest #588, Volume #33           Fri, 13 Apr 01 23:13:02 EDT

Contents:
  Re: More Microsoft security concerns: Wall Street Journal (Roy Culley)
  Re: More Microsoft security concerns: Wall Street Journal (Roy Culley)
  Re: Something cool in gcc (pete@-)
  Re: To Eric FunkenBush (GreyCloud)
  A mentality problem of linux programmer. ("JLI")
  Re: Something cool in gcc (mlw)

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

From: [EMAIL PROTECTED] (Roy Culley)
Crossposted-To: comp.os.ms-windows.nt.advocacy
Subject: Re: More Microsoft security concerns: Wall Street Journal
Date: Sat, 14 Apr 2001 03:10:05 +0200
Reply-To: [EMAIL PROTECTED]

In article <[EMAIL PROTECTED]>,
        "Aaron R. Kulkis" <[EMAIL PROTECTED]> writes:
> Chad Everett wrote:
>> 
>> >
>> >FTP is a foundation-level building block which is used by almost
>> >every network app you use.
>> >
>> 
>> Wow. I am surprised to see you make these claims.  Your claims show a
>> lack of basic understanding of networking programming.  See Stevens
>> books: "Unix Network Programming" or "TCP/IP Illustrated". Apps that
>> establish network sockets, do DNS lookups, etc. use library routines
>> (either shared libs/DLLs or statically linked) to do these things.
>> Web browsers, telnet, etc. do NOT use nslookup, or rsh, or rcp, etc.
>> they call gethostbyname(), res_query(), res_search(), etc which are
>> all in libraries.
> 
> The typical VisualBasic droid has no access to such routines.

You really are clueless Aaron. You said 'FTP is a foundation-level building
block which is used by almost every network app you use' which is just
crap. ftp is one of the oldest, if not the oldest, Internet
protocols. As suggested by Chad Everett buy both of those books learn
how IP and the higher level protocols work.

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

From: [EMAIL PROTECTED] (Roy Culley)
Subject: Re: More Microsoft security concerns: Wall Street Journal
Date: Sat, 14 Apr 2001 03:25:11 +0200
Reply-To: [EMAIL PROTECTED]

In article <[EMAIL PROTECTED]>,
        GreyCloud <[EMAIL PROTECTED]> writes:
> Jan Johanson wrote:
>> 
>> "Aaron R. Kulkis" <[EMAIL PROTECTED]> wrote in message
>> > ....however... ALL network-aware apps that accept symbolic internet
>> > addresses (host.domain.name.here as opposed to 12.34.56.78 style)
>> > use nslookup to do the conversion.
>> >
>> > I wonder if any of this is getting through Jan's shit-filled head.
>> 
>> Hello - no, they do not. They use a lookup mechanism but it's not literally
>> "nslookup.exe" which is what WE are talking about here. DOH! shithead.
> 
> I take it that you're in here for comic relief ... right??

For sure, but he is right, as in comic relief. nslookup is a
standalone app for getting info from DNS servers. Applications don't
run nslookup for DNS queries. They call gethostbyname(),
gethostbyaddr(), etc. or whatever the OS provides. Aaron is really
showing his ignorance now.

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

From: pete@- <[EMAIL PROTECTED]>
Subject: Re: Something cool in gcc
Date: 13 Apr 2001 19:08:02 -0700


well, based on a little experiment, this seems to be standard C/C++, but
when using the ucb cc compiler, I get the error.

using Sun C compiler:

>cc -c -Xa t.c
>cc -c -Xc t.c
>

These are the options -Xa and -Xc explained:

"-X[a|c|s|t]
          Specifies the degree of conformance to the ANSI/ISO C
          standard.  Specifies one of the following:

          a (ANSI)
               ANSI C plus K&R C compatibility extensions, with
               semantic changes required by ANSI C.  Where K&R C and
               ANSI C specify different semantics for the same
               construct, the compiler uses the ANSI C interpretation.
               If the -Xa option is used in con- junction with the
               -xtransition option, the com- piler issues warnings
               about the conflict. This is the default compiler mode.
               The predefined macro __STDC__ has a value of zero with
               the -Xa option.

          c (conformance)
               Strictly conformant ANSI/ISO C, without K&R C com-
               patibility extensions.  The compiler will issue errors
               and warnings for programs that use non- ANSI/ISO C
               constructs.  The predefined macro __STDC__ has a value
               of one with the -Xa option."


>
>cc -V
cc: Sun WorkShop 6 update 2 C 5.3 EA2 2001/02/24


But ucb cc does complain:


>/usr/ucb/cc -c t.c
"t.c", line 7: integral constant expression expected
>


so, it looks like ansi C allows what gcc is allowing (unless Sun latest 
C compiler is also wrong).


In article <[EMAIL PROTECTED]>, mlw says...
>
>
>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.
>
>-- 
>I'm not offering myself as an example; every life evolves by its own laws.
>------------------------
>http://www.mohawksoft.com


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

From: GreyCloud <[EMAIL PROTECTED]>
Subject: Re: To Eric FunkenBush
Date: Fri, 13 Apr 2001 19:51:51 -0700

JLI wrote:
> 
> 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;
> > }
> >

Just compile it.  If you use g++ there won't be any errors.
If you use VC++6.0 it will show you exactly where it thinks its wrong.

-- 
V

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

From: "JLI" <[EMAIL PROTECTED]>
Subject: A mentality problem of linux programmer.
Date: Sat, 14 Apr 2001 02:58:09 GMT

When someone complained in this group that something is too
difficult to do in Unix, the answer is mostly like "you are too dump",
or "this guy is paid by Microsoft".  This indicates a foundament
mentality problem of linux programmer. Here is another example
I encountered recently in our company.

We have just finished a commercial product (a C/C++ SDK) and the
setup procedure went through quite smoothly. The only thing we don't
like is that you have to set two or three environment variables
manually after the setup procedure.  So we asked our unix programmer
whether we can set the environment variables automatically during the
setup procedure. The answer we got is "if someone doesn't know how
to set an environment variable on unix, he should not program on
unix, do they?".  I didn't respond directly, but my response would be "if we
don't know or want to do such simple work for our client, we should not
sell software, do we?".

Many Linux programmers are hoppyiest not professionals. They program
for themself and for fun. There is nothing wrong with that. But if you
want to do business with software, that won't work.

JLI








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

From: mlw <[EMAIL PROTECTED]>
Subject: Re: Something cool in gcc
Date: Fri, 13 Apr 2001 23:07:53 -0400


Yea, it is freaky. I always wondered why the compilers never did this, now I
see that some (certainly not all) do. The error I get in MS-C/C++ and gcc with
ansi and pedantic defined, is that ansi forbids this, but:

        int len = strlen(string)+1;
#ifdef GCC
        char var[len];
#endif
        char *var = malloc(len);
#endif

I can see this making some kick-ass fast code.

"pete@-" wrote:
> 
> well, based on a little experiment, this seems to be standard C/C++, but
> when using the ucb cc compiler, I get the error.
> 
> using Sun C compiler:
> 
> >cc -c -Xa t.c
> >cc -c -Xc t.c
> >
> 
> These are the options -Xa and -Xc explained:
> 
> "-X[a|c|s|t]
>           Specifies the degree of conformance to the ANSI/ISO C
>           standard.  Specifies one of the following:
> 
>           a (ANSI)
>                ANSI C plus K&R C compatibility extensions, with
>                semantic changes required by ANSI C.  Where K&R C and
>                ANSI C specify different semantics for the same
>                construct, the compiler uses the ANSI C interpretation.
>                If the -Xa option is used in con- junction with the
>                -xtransition option, the com- piler issues warnings
>                about the conflict. This is the default compiler mode.
>                The predefined macro __STDC__ has a value of zero with
>                the -Xa option.
> 
>           c (conformance)
>                Strictly conformant ANSI/ISO C, without K&R C com-
>                patibility extensions.  The compiler will issue errors
>                and warnings for programs that use non- ANSI/ISO C
>                constructs.  The predefined macro __STDC__ has a value
>                of one with the -Xa option."
> 
> >
> >cc -V
> cc: Sun WorkShop 6 update 2 C 5.3 EA2 2001/02/24
> 
> But ucb cc does complain:
> 
> >/usr/ucb/cc -c t.c
> "t.c", line 7: integral constant expression expected
> >
> 
> so, it looks like ansi C allows what gcc is allowing (unless Sun latest
> C compiler is also wrong).
> 
> In article <[EMAIL PROTECTED]>, mlw says...
> >
> >
> >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.
> >
> >--
> >I'm not offering myself as an example; every life evolves by its own laws.
> >------------------------
> >http://www.mohawksoft.com

-- 
I'm not offering myself as an example; every life evolves by its own laws.
========================
http://www.mohawksoft.com

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


** 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
******************************

Reply via email to