Message 83

Re: tupleCmp

X-Added: With Flames (bblib $Revision: 1.4 $)
Return-path: <jiayu@andrew.cmu.edu>
X-Andrew-Authenticated-as: 0;andrew.cmu.edu;Network-Mail
Received: from po0.andrew.cmu.edu via trymail for bb+academic.cs.15-721@andrew.cmu.edu
          ID </afs/andrew.cmu.edu/usr0/bb/Mailbox/Evo:25O00UdY0gpU4N>;
          Fri, 19 Oct 2001 17:52:05 -0400 (EDT)
Received: from smtp6.andrew.cmu.edu (SMTP6.ANDREW.CMU.EDU [128.2.10.86])
        by po0.andrew.cmu.edu (8.9.3/8.9.3) with ESMTP id RAA11474;
        Fri, 19 Oct 2001 17:52:04 -0400 (EDT)
Received: from UNIX14.ANDREW.CMU.EDU (UNIX14.ANDREW.CMU.EDU [128.2.11.214])
        (user=jiayu mech=KERBEROS_V4 (0 bits))
        by smtp6.andrew.cmu.edu (8.12.0.Beta16/8.12.0.Beta16) with ESMTP id f9JLq46E028879;
        Fri, 19 Oct 2001 17:52:04 -0400
Date: Fri, 19 Oct 2001 17:52:04 -0400 (EDT)
From: Jia-Yu Pan <jiayu@andrew.cmu.edu>
To: Leejay Wu <lw2j+@andrew.cmu.edu>
cc: <bb+academic.cs.15-721@andrew.cmu.edu>
Subject: Re: tupleCmp
In-Reply-To: <IvmTLPm00UjCQJvT4c@andrew.cmu.edu>
Message-ID: <Pine.GSO.4.33L-022.0110191750300.12939-100000@unix14.andrew.cmu.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII

Does tupleCmp() know which attribute of the input tuples are the
attribute we want to compare?

Tim

On Sun, 14 Oct 2001, Leejay Wu wrote:

> Excerpts from academic.cs.15-721: 14-Oct-101 tupleCmp by Rose
> Hoberman@cs.cmu.edu
> > I don't understand what tupleCmp does.  How does it know
> > the types of what we're trying to compare if all
> > we pass it is a pointer to the start of the tuple?
>
> It's a simplified function for this assignment only (and, in
> fact, only for the sorter), so it assumes fixed-width ASCII
> values, which is exactly what the SMJTester.C file gives it.
> This'll work since ' ' is ((char) 32), and '0' through '9'
> are 48 to 57, respectively.
>
> So it uses strncmp(), and simply reverses the order of its
> arguments if the desired sort order requires it.
> --
> |   lw2j@cs.cmu.edu        | #include <0.0648g NaCl>     |
> |--------------------------|-----------------------------|
> |   #include <stddiscl.h>  | Spam returned to postmaster |
>
>
>
>