delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/25/00:01:37

From: ams AT ludd DOT luth DOT se (Martin Str|mberg)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: double trouble
Date: 22 Aug 1998 14:13:10 GMT
Organization: University of Lulea, Sweden
Lines: 28
Message-ID: <6rmjlm$oao$1@news.luth.se>
References: <35DEDC2F DOT BB81D366 AT virgin DOT net>
NNTP-Posting-Host: queeg.ludd.luth.se
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Stephen Snape (stephen DOT snape AT virgin DOT net) wrote:
: Could someone tell me whats wrong with this,
: 
: double var
: int num
: 
: void check_bit(void)
: {
:     return var<<num;
: }
: 
: DJGPP won't let this happen. I can't access a bit in a double, why? It
: keeps saying invalid operand to binary, and it's driving me mad.

1. Semi-colons omitted.

2. void return type but you still return something.

3. What do you really want to happen? If it was a float you could do
   some ugly casting (something like *(int *)(&var)), but IIRC,
   double's size doesn't match long or long long this wont work too
   good. So some additional code would be necessay. Anyway the result
   is almost meaningless. 


Cocteau Twins, Blue Bell Knoll,

							MartinS

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019