|
From: <rjd@us.ibm.com> Subject: Re: how to create unsigned hexadecimal initial value > I think even the more recent examples are easy to explain in terms of the > definition I gave for H literals. Bob, here is your definition: " The H literal is used to specify a signed integer value. The format is H'h1h2h3h4', where h1, h2, h3, and h4 are hexadecimal digits. If fewer than 4 digits are specified, leading zeros (0x00) are prepended. For example, H'FF' is equivalent to H'000000FF'. The sign of the value is determined by the value of h1. The largest positive value that can specified is 2147483647 (H'7FFFFFFF'). [Note: this is not unlike integer literals in C++. For example, 0xff in the following statement represents the value 255, not -1: int h = 0xff;] The length of an H literal is the minimum number of bytes needed to represent the value. The length of a negative value is always 4 bytes. " I'll try to rewrite it the way I think you meant it: " The H literal is used to specify an integer value. The format is H'h1h2h3h4h5h6h7h8', where h1, h2, h3, h4, h5, h6, h7, and h8 are hexadecimal digits. If fewer than 8 digits are specified, leading zeros (0x00) are prepended. For example, H'FF' is equivalent to H'000000FF'. The sign of the value is determined by the value of h1. The largest positive value that can specified is 2147483647 (H'7FFFFFFF'). The smallest negative value that can be specified is -2147483648 (H'80000000'). The length of an H literal is always 4 bytes. ". The problem Gene had has really nothing to do with the H literal, but is simply that one cannot initialize an unsigned integer with a negative value regardless of its size. +--- | This is the MI Programmers Mailing List! | To submit a new message, send your mail to MI400@midrange.com. | To subscribe to this list send email to MI400-SUB@midrange.com. | To unsubscribe from this list send email to MI400-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: dr2@cssas400.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.