public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* bitset
@ 2008-07-10 10:20 Rudra Banerjee
  2008-07-10 11:25 ` bitset Rupert Wood
  0 siblings, 1 reply; 2+ messages in thread
From: Rudra Banerjee @ 2008-07-10 10:20 UTC (permalink / raw)
  To: gcc

Dear friends, 
i am in mess with bitset again. i have managed to write a messy code 
which checks the machine bitsize and then wants to do a bitflip. here 
is the code: 
int bit; 
if (strncmp(sysptr, "i686",4)==0) 
{ 
bit=32; 

} 

...... 
bitset<32> i (0); 
....etc. 
where in bitset is equal to bit,which is 32. but i tried to write the 
bitset as *bitset<bit> i (0);*(i.e. to read the bit as an integer variable) 
where its giving the error:error: ‘bit’ cannot appear in a constant- expression 
can you tell me a way to make that possible? 
 
-- 
Rudra
JRF; SNBNCBS
http://www.bose.res.in/~rudra

A bus station is where a bus stops. A train station is where a train
stops. On my desk I have a work  station.

Please, if possible, don't  send me MS Word or PowerPoint attachments 
Why?See:  http://www.gnu.org/philosophy/no-word-attachments.html




----- Original Message ----
From: "gcc-help-digest-help@gcc.gnu.org" <gcc-help-digest-help@gcc.gnu.org>
To: gcc-help@gcc.gnu.org
Sent: Thursday, 10 July, 2008 4:00:09 AM
Subject: gcc-help Digest 9 Jul 2008 22:30:09 -0000 Issue 2773


gcc-help Digest 9 Jul 2008 22:30:09 -0000 Issue 2773

Topics (messages 33368 through 33386):

directory separators in compiler generated assembly code
    33368 by: Brian Dessent <brian@dessent.net>
    33379 by: "Joe Tilton" <jhtilton@gmail.com>

Including <iostream> affects whether or not program freezes?
    33369 by: "James Gregory" <james.jrg@gmail.com>
    33372 by: Lionel B <lionelb.nospam@gmail.com>
    33375 by: "Andrew Bell" <andrew.bell.ia@gmail.com>
    33376 by: Andrew Haley <aph@redhat.com>
    33380 by: "James Gregory" <james.jrg@gmail.com>
    33381 by: "Chris Jefferson" <chris@bubblescope.net>
    33382 by: Burlen Loring <burlen..loring@kitware.com>

rambling about cross build inefficiencies, unclarities, and  pie-in-the-sky
    33370 by: Jay <jayk123@hotmail.com>

bitset in C
    33371 by: Rudra Banerjee <bnrj.rudra@yahoo.com>
    33383 by: Dan Hipschman <dsh@linux.ucla.edu>

gcc for AIX
    33373 by: "Vardhan, Sundara (GE Infra, Energy)" <sundara.vardhan@ge.com>
    33374 by: "Eric Fernandez" <efernandez@physiomics-plc.com>

Passing information from analysis pass to assembly code
    33377 by: Timothy M Jones <tjones1@inf.ed.ac.uk>

Little Endian vs Big Endian
    33378 by: "Vardhan, Sundara (GE Infra, Energy)" <sundara.vardhan@ge.com>

Gcc 4.3.1 installed , butproblem is with the asseembler
    33384 by: gcc_help <pganesh@moris.org>

questions about gcc PIC port
    33385 by: Platone Ilia <plato@uruzuki.com>

GCC-4.3.1 source from mirror - no configure file
    33386 by: "Ellis Robin (Bundaberg)" <Robin.Ellis@nrw.qld.gov.au>

Administrivia:

To subscribe to the digest, e-mail:
    gcc-help-digest-subscribe@gcc.gnu.org

To unsubscribe from the digest, e-mail:
    gcc-help-digest-unsubscribe@gcc.gnu.org

To post to the list, e-mail:
    gcc-help@gcc.gnu.org


----------------------------------------------------------------------
Hi list, I just downloaded the gcc-4.3.1 source (gcc-4.3.1.tar.gz) from
an ftp in Japan (ftp://ftp.dti.ad.jp/pub/lang/gcc/releases/gcc-4.3.1)
and have attempted to configure from my build directory on solaris 10,
only to find that I don't have a 'configure' file in my source. Is this
just a temporary glitch, or has the configuration requirements changed
since early February?

Thanks

Rob

************************************************************************
The information in this email together with any attachments is
intended only for the person or entity to which it is addressed
and may contain confidential and/or privileged material.
Any form of review, disclosure, modification, distribution
and/or publication of this email message is prohibited, unless
as a necessary part of Departmental business.
If you have received this message in error, you are asked to
inform the sender as quickly as possible and delete this message
and any copies of this message from your computer and/or your
computer system network.
************************************************************************


      Save all your chat conversations. Find them online at http://in.messenger.yahoo.com/webmessengerpromo.php

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: bitset
  2008-07-10 10:20 bitset Rudra Banerjee
@ 2008-07-10 11:25 ` Rupert Wood
  0 siblings, 0 replies; 2+ messages in thread
From: Rupert Wood @ 2008-07-10 11:25 UTC (permalink / raw)
  To: 'Rudra Banerjee'; +Cc: 'gcc'

Rudra Banerjee wrote:

> bitset<bit> i (0);*(i.e. to read the bit as an integer variable)

No, what you're actually saying there is "define i as a bitset container for 'bit' bits". Since 'bit' can vary at runtime the compiler won't let you do this.

I don't know bitsets but looking at the docs to access bit x of a bitset container b you can use:

    b.test(x)

To test bit x of an integer i without using bitsets you can use:

    if ((i && (1 << x)) != 0)

or similar. Note that if i is something other than an integer you'll need a type suffix on the 1 in that expression, e.g. 1LL for long longs.

Hope that helps!
Rup.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-10 11:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-10 10:20 bitset Rudra Banerjee
2008-07-10 11:25 ` bitset Rupert Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).