Enum size question

The following code compiles with gcc but not the Sun compiler:
#include <limits.h>
enum a  { aA = ~(1<<10) } ;
enum b  { bA  = ULONG_MAX } ;
enum c  { cA = ~(1<<10), cB  = ULONG_MAX } ;
CC -c -m32 test.cpp"test.cpp", line 4: Error: c is not within the range of a long or unsigned long.
From a quick browse, it appears gcc enums are of type unsigned but Sun enums are signed. But if that is the case the above is rather confusing:
- firstly the error message does not indicate which member of c is causing the problem
- the error is ambiguous. What is the limit, is it long or unsigned long? If the latter I believe it should be ok. The fact the error says "or unsigned long" means that must be an option - if so, can I enable enums to be of type unsigned somehow?
- Why does it give me an error for enum c but not a or b, which contain the same values?
Our code is full of enums using ~x and using unsigned UINT_MAX values, so this looks like it could be a showstopper for us in our Sun compiler evaluation. Any information is appreciated.

Sun C++ follows the C++ standard (refer to section 7.2).
An enumeration type has an underlying type that is large enough to hold all the enumeration values. The type shall not be larger than int unless the value won't fit in an int or unsigned int. Other possible underlying types include long and unsigned long.
In this case, the enumeration values are -1025 and ULONG_MAX. That range of values cannnot be represented in a 32-bit environment by type long (can't represent ULONG_MAX) or unsigned long (can't represent a negative value). The error message does not point to either value because either one is OK by itself -- the combination is not OK.
Experimenting with g++ shows that it uses type long long for the underlying type, a non-standard language extension. Sun C++ does not support enums larger than long or unsigned long.
To make your code conform to the requirements of the C++ Standard, you must restrict the range of the enum values. Depending on whether you intend ~(1<<10) to be treated as negative or as unsigned, two choices are enum c  { cA = unsigned(~(1<<10)) ,  cB  = ULONG_MAX } ;
enum c  { cA = ~(1<<10) ,    cB  = LONG_MAX } ;

Similar Messages

  • IMovie 6 HD - Export Movie Size Question

    There is a confusing list of movie export size options that I need to get your clarification about. Some of the selections seem to be similar.
    To see what I am referring to go into iMovie HD 6, under the SHARE menu, go to Save Movie For: Expert Settings Export Settings > Select Movie to QuickTime Movie (then hit the options tab to the right > Under the Video Section, select SIZE - note the Export Size Settings - DImensions drop down list. Note there are two sections. The last two items in the top section listed are (exactly worded as) 1280 x 720 HD and 1920 X 1080 HD. In the bottom section the last three entries are HD 1280 x 720 16:9, HD 1440 x 1080 16:9 and HD 1920 x 1080 16:9. What's the difference, for example, between the 1280 x 780 HD and the bottom one HD 1280 x 780 16:9? I ask because my HD camcorder movie footage (shot at 1080i, 29.97, 16:9) with an HV30 exports smooth at 1280x720 HD but jerky at HD 1280 x 780 16:9. They sound the same, but one is jerky and one smooth.
    The other question I have is 1440x1040 is 4:3 ratio. But it exports at 16:9 aspect ratio. I don't understand why.

    Donna:
    While I have a lot of video editing experience with an SD digital camcorder, the Canon HV30 HDV cam is new to me. So I am experimenting. That said, footage that will be shot will end up in a couple of places. Some of it will be passed onto my company's web master for posting to the web in some kind of Flash video format. Other video will be used in Keynote presentations as full screen video clips. Others will be used as source video for creating 4x3 SD clips for PowerPoint on a PC by others. So, the video will be used in different formats. (In what format to shoot is another question, but I have concluded (I hope correctly) that I should just shoot HDV 1080i since it seems to be the easiest to deal with for uploading to iMovie6 HD.)
    The purpose of my inquiry was to determine what the various selections are used for and what they do. Sometimes the video is jerky, sometimes an identical movie size is smooth (but must be rendered or processed differently). I was only trying to determine why there appeared to be repetative choices in the list of movie sizes as I mentioned in my original post. To be blunt, iMovie 6 HD documentation is spotty at best. The O"Reilly books don't cover the hard parts.

  • IMac (24-inch, Early 2009) Hard Drive Replacement: Hybrid and Maximum Size Question

    I have a 24-inch iMac, early 2009 model and the internal hard drive has died so am looking to replace it and also upgrade it in the process.
    At the moment the broken internal drive was the standard 1TB model that comes with the computer. I have been doing a little bit of research and I'm liking the sound of a hybrid drive as they seem to be a relatively economical was of achieving close to SSD speeds. I've been looking particularly at 'Seagate ST4000DX001 DESKTOP SSHD 4TB SATA 6GB/s NCQ NAND 8GB 64MB HYBRID' for the replacement. I guess my question is if this drive will work in the iMac. Does a hybrid drive present and problems? Also, is there a limit to the maximum size the replacement drive can be? Will 4TB exceed this limit? Lastly, I understand this drive uses SATA III to connect with the computer, which is backwards compatible (I think?) so I'm presuming this will work in my iMac?
    Thanks in advance.

    The hybrid drive will kinda sorta be as fast as an SSD. The newest Seagate Hybrid is quite intelligent about caching the most often used files in flash and is quite an improvement over the first iteration. I used both the first and second generation drives in my 2007 iMac and was quite impressed with their performance…until I installed an SSD. The problem with the hybrids is that they just don’t have enough flash and no matter how intelligent the drive is it is guesswork so sometimes you’ll find the drive access just as pokey as any other 5400 RPM drive and then other times very fast.
    For about $200 it is a decent upgrade but with SSD prices having dropped nearly 50% in the last 18 months it is worth considering a smallish internal SSD for the OS and applications and an external drive for data.

  • File size questions

    new to Apple MAC and iPhoto...so....I shot my new camera in jpeg, files are roughly 20mb...then I shot in RAW and after editing, the saved jpegs are ~ 5-10mb and up to 15mb....what happens to make this discrepency? how could my RAW converted jpegs be ~ 1/3 the size of straight out of camera jpegs?
    another question...iPhoto is 1.7 gb, my iPhoto Library size it 37gb, but my pictures in iPhoto total 17gb.....is the discrepecy due to stuff like Slideshows I created? Faces just is referring the files right, not making duplicate files?...having trouble wrappping my head around stuff I''m seeing that doesn't add up...
    thanks

    It's all a bit more complex that that. There is no correlation between file size and the quality of a shot. A well exposed shot of 2 or 3 mb will print just as well as a well exposed shot of 25mb. There is no difference in what gets printed. A poorly exposed shot of 25mb will print like garbage.
    It gets worse, we used to suggest a rule of thumb that printing at 300dpi was a reasonable giude to printing quality. Not any more. Printers and cameras have improved, iPhoto books are uploaded at something akin to 150 dpi.
    Again, a 3 mb jpeg will print exactly as well as a 30 mb tiff.
    Remember, the internet is full of high quality images that weigh in at a lot less than 500kb.
    Where file size comes into play is when you're using destructive editing on a lossy format, like Jpeg, and, as I said above, that doesn't come into play in a non-destructive editing system like iPhoto.
    The output from the export will - depending on the settings you use - either be smaller or larger than the jepg from a camera. It means very little - unless you're going to go an an edited destructively.

  • Oracle Block Size - question for experts

    Hi ,
    For years i thought that my system block size was 8K.
    Lately due to an HPUX Bug i found that the file system block size is gust .... 1K
    (HP DocId: DCLKBRC00006913 fstyp(1m) returns unexpected block size (f_bsize) for VXFS )
    My instance is currently 10204 but previously was 7.3 --> 8 --> 8174 --> 10204.
    Since its old instance its block size is gust 4kb.
    We are planing to create new file system block size of 8k.
    The instance size is about 2 TB.
    Creating the whole database with 8 kb is impossible since its 24*7 instance.
    Do you think that i sould move gust few important tables to a new tablespace with 8k block size , or should i leave it with 4 kb ?
    Thanks

    Given that your Oracle Database Block_Size (4K) is a multiple of the FileSystem Block_Size (1K), there should be no inherent significant issue, as such.
    Yes, it would have been nice to have an 8KB Oracle Database Block_Size but whether you should recreate your FileSystems to 8KB is a difficult question. There would be implications on PreFetch that the OS does and on how the underlying Storage (must be a SAN, I presume) handles those requests.
    A thorough test (if you can setup a test environment for 2TB such that it does NOT share the same HW, doesn't complicate PreFetches in the existing SAN) would be well adviced.
    Else, check with HP and Veritas support if there are known issues and/or any Desupport plans for this combination ?!
    Oracle, obviously, would have issues with Index Key Length sizes if the Block Size is 4KB. Presumably you do not need to add any new indexes with very large keys.
    Having said that, you would have read all those posts about how Oracle doesn't (or really does ?) test every different block-size ! However, Oracle had, before 8i, been using 2K and 4K block sizes. Except that the new features (LMT, ASSM etc) may not have been well tested.
    Since you upgraded from 7.3 in place without changing the Block_Size, I would venture to say that your database is still using Dictionary Managed and Manual Allocation and Segment Space Management Manual ?
    Hemant K Chitale
    http://hemantoracledba.blogspot.com

  • Player size question for player developers

    Question for all player developers:
    For media players that you've built or that you've seen out on the web today, how big are they in k?  And of that total size, how much code does it take to support each of the service integrations with CDNs, ad servers/networks, analytics services, and content management systems? 
    I'm interested in total player size, the % of that total devoted to each type of service integration, and the average for an individual service integration.
    -Sumner

    As I understand it, the new FME (Jan 2008?) will include
    support for mp3 audio and much higher audio bitrates, as well as
    possibly DRM.

  • Canon sRAW to DNG Size Question

    Hi,
    I shot some images with my Canon 40D set to sRAW. A sample image size is 6.1 MB. In Lightroom 1.3.1, I convert the RAW (.CR2) file to DNG. The resulting DNG file is 6.7MB in size. The DNG Creation settings I used in the conversion were:
    JPEG preview: None
    Image Conversion Method: Preserve Raw Image
    Options: Compressed - ON / Embed Original Raw File - OFF
    I was under the impression that DNG format would be smaller than the RAW format.
    Is this larger DNG file because my original RAW file was a compressed RAW file (sRAW) and, as a result, the RAW image needs to be uncompressed before it is converted into a DNG file? If the original RAW image was NOT compressed, would I be seeing a reduction if file size after the DNG conversion.
    I guess the heart of my questions is this: Will conversion from RAW to DNG only provide a file size reduction if the original RAW file is uncompressed? Is it normal for me to see an increase in size when converting from sRAW to DNG, due to the fact that the original RAW file is a compressed RAW format?
    Thanks in advance for your clarification.
    Steve

    The reason for the larger DNG file is quite complicated, one needs to know some JPEG details. In short, the original sRaw file contains four 15 bit pixel values for two pixels, while the DNG file contains three values per pixel.
    The size difference would be much larger if the CR2 file did not contain a 050 KB large thumbnail, which is in the DNG file only between 100 KB abd 200 KB large (approximation).
    Plus, the DNG converter fine-tunes the compression; this is not affordable in-camera.

  • JPEG - Original Size question

    Hi gang,
    Strange question.
    I accidentally edited my Export .. Versions ... JPEG Original Size settings. Can someone let me know the original settings?
    Cheers!

    H there,
    "Original Size" picks up the resolution from the image, so is image dependent.
    The DPI settings by default are 300.
    G.

  • Site Size Question? How many Pixels?

    Hi, you can view my site here:
    http://www.recordingnyc.com
    My question is: My site is 800 Pixels wide. I think I read
    somewhere ages ago that if you don't have a site that's 100% width,
    you should keep the size to 800px. Is this true....or should I say
    is this true anymore? I would like my site to be, let's say 950px
    wide. Would that not be a good idea for technical reasons?
    Also, feel free to critique my site. After 20 years of not
    advertising my services, I finally decided to bite the bullet and
    build one. Please let me know what you think and how I could
    improve it?
    Thank you very much for any help!

    engmix wrote:
    > Hi, you can view my site here:
    http://www.recordingnyc.com
    >
    > My question is: My site is 800 Pixels wide. I think I
    read somewhere ages ago
    > that if you don't have a site that's 100% width, you
    should keep the size to
    > 800px. Is this true....or should I say is this true
    anymore? I would like my
    > site to be, let's say 950px wide. Would that not be a
    good idea for technical
    > reasons?
    You pays your money you takes your choice to be honest.
    Nothing can be
    considered to cover everything and every ones screen/browser
    set ups.
    The higher the screen resolution the more the end user can
    accommodate a
    wider design in their browser window (the browser window
    being set at
    what physical size, in proportion to the screen, they think
    is
    'comfortable').
    If you change your pages width from 800px to 950px at the
    current screen
    resolution that my computer is set up at it will show
    horizontal
    scrollbars. If I alter my screen resolution to be higher than
    it
    currently is I can then open the browser widow wider and your
    page will
    most likely be ok at 950px width.
    If you leave your page width at 800px wide and I still alter
    my screen
    resolution to higher than it currently is your page looks as
    though it
    should be wider i.e., you have excess amounts of black real
    estate on
    both the left and right. If the page is set left and not
    centered this
    obviously compounds the problem.
    The answer is YOU CANNOT design for everyones computer set up
    unless you
    use a fluid page width i.e. set it at 100%.
    I would stay at around 750px - 800px so you can take
    advantage of more
    users. The facts (if they are to be believed) reveal there
    are more
    people still using lower resolution set ups than those that
    are using
    higher ones.
    > Also, feel free to critique my site. After 20 years of
    not advertising my
    > services, I finally decided to bite the bullet and build
    one. Please let me
    > know what you think and how I could improve it?
    On the up side your site is clean and user friendly but lacks
    any visual
    stimulant for my tastes.
    Personally I think its too boxy and looks detached rather
    than being one
    entity.
    Ulitmately there is nothing wrong with it but its just
    lacking a little
    bit of 'magic dust' of some kind.
    I wouldn't take the critic too much to heart, I just feel it
    could
    somehow hang together a little better and make me want to
    take a look
    around a bit more than I do.
    Obviously if youre not from a design background then its a
    mighty good
    effort. If you are then you should be able to do a little
    better.

  • MSI P6N SLI Platinum Voltage regulator cooler size question

    I have a question about MSI P6N SLI Platinum's Voltage regulator cooler. Is it the same size of K9N SLI Platinum? The reason I ask is I plan to use water cooling on it. But the only regulator  waterblock I can find is desgined for K9N SLI Platinum from aqua computer http://www.aqua-pcs.co.uk/index.asp?function=DISPLAYPRODUCT&productid=218. So can I use this one on P6N SLI?

    I guess not... P6N is much thinner, if your K9N VR cooler is as thin, then it can fit in. But I guess not.

  • Custom Page Size Question

    If I choose one of the fly-out "edit page size options" at the bottom of the pages palette, such as compact disc or business card, why does the page size still say 8.1/2 x 11 if I go to--> "document set-up"? Is there a way that you can tell the actual size of the card or disc short of drawing a text or pic box? Also- if I have a document that is supposed to be several 8.1/2 x11 pages, and one page is set up at 7x11. Is there a way to find that out w/o weeding thru the entire doc? I cant find anything in Preflight that clues you in on that. Thanks for any input on this.

    When first added, I thought multiple page sizes would be a great addition for doing things like book jackets (for easily adjusting the spine) and Letterhead, Envelope and Business Card packages (for easy organization) but after seeing it in action I've pretty much decided there is no particular advantage, and quite a few drawbacks, in a print output workflow. It makes more sense, perhaps, in a workflow intended for mobile devices, paricularly something that needs two orientations of the same page for those who want to rotate their tablet screen, and I suspect it was envisioned as part of the apparent push to move ID into the new realm of digital publishing.

  • Linked Smart Objects - File Size Question

    Hey guys,
    first time using linked smart objects and I was pretty excited about it at first. I have a large photoshop file with 1920x1080 image assets. The file size is about 1GB and everytime I make a minor change the entire file has to be re-uploaded to my Dropbox.
    So I figured that I could make all these image assets linked smart objects so that I can keep the master file down in file size since most of the actual assets don't change. However, even the PSD that contains nothing by linked smart layer objects is already 400MB large. And that's in addition to the external PSD's it is now linking to.
    Even if I duplicate a linked smart layer object in this PSD file it increased the file size by an additional 10MB per duplicate. Is this supposed to happen? Why does it take so much space to just link to external objects? I was super excited about using linked smart layer objects but this doesn't look like it would be helping much to decrease file size.
    Any thoughts would be much appreciated!
    Thanks,
    Philipp

    Hey Chris,
    thanks again! I guess I just had different expectations. In my mind I was going to see a parent file around 10MB or something with all of the content being dynamically loaded from the linked smart objects.
    Maybe that could be a feature requests for future versions.

  • IBooks Author Page Size Question

    I would like to use iBooks Author to put together a book for print (instead of using InDesign which is not intuitive for photo placement). iBooks Author looks good and the templates seem to work very well, but I have found no way to specify total page size dimensions - specifically A4 (210 × 297 mm) in portrait orientation.
    Also the PDF export - which I should be able to use for printing - has strange lines around the overall graphics (indicating larger actual document size?), and has a big watermark at the bottom reading "iBooks Author," which wouldn't be good for printing.
    Can anyone give me instructions as to how I can:
    1) Specify page spread dimensions for the whole document (except for the cover which I will design separately)?
    2) Export to PDF in proper printing format without faulty document dimensions or watermarks?

    esagustin013,
    Indesign as well as Quark are still the mainstream layout tools fore creating Print collateral...as of the latest versions of InDesign and Quark...both are beginning to introduce ebook production.
    As for your last sentence, it is not true that both are beginning to introduce eBook production. Adobe InDesign has been doing that for a couple of years, along with PDF technology. Now it even gets much better and, it is true that it is getting more powerful. It is not recommended for novices to use these apps, so iBooks Author app is a very nice simpe app especially designed for iPad platform.
    I would highly suggest you search for a tutorial pertaining to how to place images into indesign and how to minipulate them with your text boxes. Far more power in these programs...completely tailored for Print.
    Again, last sentence, it is not true that it was completely tailored for Print production. Adobe InDesign app is a totally different app now than it was once developed for at the time when Adobe first released InDesign 1.0 some years ago. I can't believe how time flew from 1.0 to now CS5.5. However, you are correct it is very powerful professional layout app for print and even eBook production and even ePUB production and all. And even PDF files for web. Even it works just fine in iPad opening PDF files.
    I am intrigued by iBooks Author is capable of making more interactive iPad iBook textbooks.
    I am interested about what Adobe have to say about iBooks Author app.   I wonder if Apple eventually develop professional-grade layout app - more powerful than that of iBooks Author or iWorks app. I guess we'll wait and see. Probably not.

  • Image Size Question

    In Photoshop CS6 two of the options in the 'Image Size' dialog box are 'Bicubic Smoother (best for enlargement) and Bicubic Sharper (best for reduction). I have assumed this referred to a reduction or enlargement in the height and width of the image but do these options also refer to an enlargement or reduction of the image resolution?
    I often keep the height and width of an image the same but change its resolution up or down, so should I apply 'Bicubic Smoother' and 'Bicubic Sharper' when I changing only the resolution? Many thanks for your help.

    Hello,
    The Bicubic choices refer to if you are changing the number of pixels. If you are adding pixels, that is considered "enlargement" even if the print size stays the same. Look at the top numbers (Width and Height of Pixel Dimensions) in the Image Size Dialog. That shows you any real resizing taking place. Print Size and PPI are meaningless individually. They are just two factors whose product is the Pixel Dimension.
    If you are reducing number of pixels, you can choose Bicubic Sharper, but many feel that down-sample algorithm can over sharpen. New in CS6 is Bicubic Automatic, which will apply Bicubic Smoother or Sharper depending if you are up-sampling or down-sampling the image.

  • JScrollPane viewport size question

    Hi all,
    I've a component that is very large (it has a dinamic height) but its width is always the same (fixed). I need to show this component in a JScrollPane container and only shows the vertical scrollbar. It works fine but when my applications runs, the component inside the JScrollPane (yes..my component) get a different width, which is larger than the original componet's width
    I'm using the following code:
            JScrollPane scroll = new JScrollPane(myComponent);
            scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);My question is, How I can do for set a fixed width to the JScrollPane (its viewport or its child component) in order to get the correct component width and only allows a dinamic height ?
    thanks in advance

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.Random;
    public class Test3 extends JFrame {
      JPanel jp = new JPanel();
      JScrollPane jsp = new JScrollPane(jp);
      JLabel jl = new JLabel("", JLabel.CENTER);
      Random rand = new Random();
      public Test3(){
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container content = getContentPane();
        content.add(jl, BorderLayout.NORTH);
        jp.setBorder(BorderFactory.createLineBorder(Color.blue));
        jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        jsp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        content.add(jsp, BorderLayout.CENTER);
        JButton jb = new JButton("Random Height");
        content.add(jb, BorderLayout.SOUTH);
        jb.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            int height = rand.nextInt(1000);
            jp.setPreferredSize(new Dimension(jsp.getViewport().getWidth(),height));
            jsp.getViewport().revalidate();
            jl.setText(""+height);
        setSize(300,300);
      public static void main(String[] args) {new Test3().setVisible(true); }
    }

Maybe you are looking for

  • Messaging With Multiple Devices on the Same iTunes Account

    My husband and I each have an iPhone 4s.  We share the same iTunes account.  We have never had any problems texting.  My daughter got an iPod Touch for Christmas.  So we set it up using the same iTunes account (since I was told you can have up to 5 d

  • Is it possible to buy iPhone 4 without a simlock

    Hi I am from Turkey and will be visiting USA. Im thinking of buying an iPhone 4 without a contract as its much cheaper there(about 1/3 of the price of here). But as far as i read on the internet even if you buy without a contract the phones come with

  • Vaildating File name with the data in the file using sender file adapter

    Hi, Below is the scenario 1)       Pick up files from a FTP server, the file name is dynamic, how do I put dynamic name in sender file adapter? 2)       Determine if the user correctly named the file based on data in the file. a.       File naming st

  • Adobe on iSeries

    Hello Gurus, i'm right now installing  a NW 7.3 Java with the Adobe Usage type. Does any of you have a "post Configuration/Processing manual" that I can follow to configure Adobe ? One litle more question, in the old Adobe that I've (Double Stack Aba

  • User exits while changing the PO Output Medium

    Hello Champions, Will anyone share me, is there any user exit which triggers while changing Purchase Order Output Medium in ME22N transaction.  How to know list of user exits which are applicable for ME22N transaction?.  will anyone guide me. Reward