Message 127

CompareTupleWithTuple

X-Added: With Flames (bblib $Revision: 1.4 $)
Return-path: <cynews+@port.fac.cs.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/IvxOsUK00UdYRj:U40>;
          Fri, 16 Nov 2001 19:24:00 -0500 (EST)
Received: from mx2.andrew.cmu.edu (MX2.ANDREW.CMU.EDU [128.2.10.112])
        by po0.andrew.cmu.edu (8.9.3/8.9.3) with ESMTP id TAA28448
        for <bb+academic.cs.15-721@ams.andrew.cmu.edu>; Fri, 16 Nov 2001 19:23:59 -0500 (EST)
Received: from port.fac.cs.cmu.edu (PORT.FAC.CS.CMU.EDU [128.2.209.118])
        by mx2.andrew.cmu.edu (8.12.0.Beta16/8.12.0.Beta16) with SMTP id fAH0Nwu0024552
        for <post+academic.cs.15-721@andrew.cmu.edu>; Fri, 16 Nov 2001 19:23:58 -0500
Received: from GS254.SP.CS.CMU.EDU ([128.2.191.226]) via cynntpd
        by port.fac.cs.cmu.edu; Fri, 16 Nov 01 19:23:30 EST
Message-ID: <3BF5AE02.CD09AC@cs.cmu.edu>
Date: Fri, 16 Nov 2001 19:23:30 -0500
From: Francisco Pereira <fpereira+@cs.cmu.edu>
Organization: School of Computer Science, Carnegie Mellon University
X-Mailer: Mozilla 4.7 [en] (X11; U; Linux 2.0.36 i686)
X-Accept-Language: en
MIME-Version: 1.0
X-Orig-To: stavros@cs.cmu.edu
X-Orig-CC: dbohus@cs.cmu.edu
Subject: CompareTupleWithTuple
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: "cyrus.academic.cs.15-721" <post+academic.cs.15-721@andrew.cmu.edu>
Sender: cynews+@port.fac.cs.cmu.edu

Stavro,

the handout mentions a comparison function we have to pass to qsort,
namely:

> a pointer to your comparison function. (The ordering function that you
pass to qsort should call the CompareTupleWithTuple
> function that we supply in the tuple_utils module.)

I couldn't find a function with that name. Is this the one in
SORTTester?

int SORTTester::tupleCmp (const void* t1, const void* t2 )
{
    if (sortOrder == Ascending)
      return strncmp((char*)t1,(char*)t2,keySize);
     else
       return strncmp((char*)t2,(char*)t1,keySize);
}

thanks!
francisco