Hi,
Is there a way to change the sizeof int type? Is it posible to make it
return 3 or 5 by changing some header file in the compiler?
Thanks in advance.
Jul 22 '06
56 3894
Tak-Shing Chan wrote:
On Sun, 23 Jul 2006, Mark McIntyre wrote:
>On Sun, 23 Jul 2006 20:05:55 +0100, in comp.lang.c , Tak-Shing Chan <t.****@gold.ac.ukwrote:
>>On Sun, 23 Jul 2006, Mark McIntyre wrote:
What do you mean by ``C as such''? All I am saying is that C does have a ``concept'' of word length, even though the behaviour of the abstract machine does not depend on it.
I disagree. The very para you quote is a reference to a different standard, it does NOT refer to any feature of C.
<extreme analogy> You could as well claim that C has a concept of ISO, because its mentioned on several pages. </end>
Your analogy is broken. The paragraph I quoted refers to a
normative reference of the standard. According to the standard:
``The following normative documents contain provisions
which, through reference in this text, constitute provisions of
this International Standard'' (ISO/IEC 9899:1999, 2 para. 1).
The standard continues: ``ISO 60559:1989, Binary
floating-point arithmetic for microprocessor systems (previously
designated IEC 559:1989)'' (ISO/IEC 9899:1999, 2 para. 8).
Then we have, in Annex F, an explicit reference to
ISO 60559:1989, making it a provision of C as well.
Surely, a 'word' is that amount of information the cpu can get from
memory in a single access. It is usually (not always) the width of the
accumulator.
The Intel family of cpu's is interesting. The 8080 and 8085 has
eight-bit words and eight-bit accumulators. The 8086 has 16-bit word and
accumulator. The 8088 has 8-bit word and 16-bit accumulator.
The 80386 and 80486 have 32-bit word and accumulator. The 80586
(Pentium) has 32-bit accumulator and 64-bit memory word.
There are C implementations for each of these processors. None of them
require or even allow the C programmer to know the width of the memory
word nor that of the accumulator.
I realize that accumulator may not be defined in the C standard, but all
our machines have at lease one. :-)
--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein --- wr********@gmail.com wrote:
>
Hi,
Is there a way to change the sizeof int type? Is it posible to make it
return 3 or 5 by changing some header file in the compiler?
If the compiler supports it, yes. (However, how this is done is not
topical to clc. You would need to check the documentation for the
compiler on how to do this.) If the compiler doesn't support it, then
there is nothing you can do (short of using, or writing, a different
compiler) do get 3 or 5 byte ints.
--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h|
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:Th*************@gmail.com>
Joe Wright <jo********@comcast.netwrites:
Surely, a 'word' is that amount of information the cpu can get from
memory in a single access. It is usually (not always) the width of the
accumulator.
I don't think there's any general agreement on how to define the
"word size" of a machine.
--
"...what folly I commit, I dedicate to you."
--William Shakespeare, _Troilus and Cressida_
On Mon, 24 Jul 2006 00:53:03 +0100, in comp.lang.c , Tak-Shing Chan
<t.****@gold.ac.ukwrote:
>On Sun, 23 Jul 2006, Mark McIntyre wrote:
><extreme analogy> You could as well claim that C has a concept of ISO, because its mentioned on several pages. </end>
Your analogy is broken.
Nope.
>The paragraph I quoted refers to a normative reference of the standard.
So what? ISO gets mentioned in normative sections.
--
Mark McIntyre
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
On Mon, 24 Jul 2006, Mark McIntyre wrote:
On Mon, 24 Jul 2006 00:53:03 +0100, in comp.lang.c , Tak-Shing Chan
<t.****@gold.ac.ukwrote:
>On Sun, 23 Jul 2006, Mark McIntyre wrote:
>><extreme analogy> You could as well claim that C has a concept of ISO, because its mentioned on several pages. </end>
Your analogy is broken.
Nope.
>The paragraph I quoted refers to a normative reference of the standard.
So what? ISO gets mentioned in normative sections.
There are no normative references for ``ISO'' in the entire
C standard. See clause 2 for the list of normative references.
Tak-Shing
On Tue, 25 Jul 2006 00:30:21 +0100, in comp.lang.c , Tak-Shing Chan
<t.****@gold.ac.ukwrote:
>
There are no normative references for ``ISO'' in the entire C standard. See clause 2 for the list of normative references.
*shrug*.
You're wrong, youre too stubborn to admit it. I can live with that.
EOT
--
Mark McIntyre
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
On Tue, 25 Jul 2006, Mark McIntyre wrote:
On Tue, 25 Jul 2006 00:30:21 +0100, in comp.lang.c , Tak-Shing Chan
<t.****@gold.ac.ukwrote:
>> There are no normative references for ``ISO'' in the entire C standard. See clause 2 for the list of normative references.
*shrug*.
You're wrong, youre too stubborn to admit it. I can live with that.
EOT
On the contrary, my point is fully supported by ISO/IEC
9899:1999 (E).
Are you disagreeing with the C standard? Are you saying
that the C standard is wrong?
Tak-Shing This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sunil Menon |
last post by:
Dear All,
A class having no member variables and only a method sizeof(object)
will return 1byte in ANSI and two bytes in Unicode.
I have the answer for this of how in works in ANSI. But I don't...
|
by: Xiangliang Meng |
last post by:
Hi, all.
What will we get from sizeof(a class without data members and virtual
functions)?
For example:
class abnormity {
public:
string name() { return "abnormity"; }
|
by: Martin Pohlack |
last post by:
Hi,
I have a funtion which shall compute the amount for a later malloc. In
this function I need the sizes of some struct members without having an
instance or pointer of the struct.
As...
|
by: M Welinder |
last post by:
This doesn't work with any C compiler that I can find. They all report a
syntax error:
printf ("%d\n", (int)sizeof (char)(char)2);
Now the question is "why?" "sizeof" and "(char)" have...
|
by: dam_fool_2003 |
last post by:
#include<stdio.h>
int main(void)
{
unsigned int a=20,b=50, c = sizeof b+a;
printf("%d\n",c);
return 0;
}
out put:
24
|
by: Christopher C. Stacy |
last post by:
Some people say sizeof(type) and other say sizeof(variable).
Why?
|
by: junky_fellow |
last post by:
Consider the following piece of code:
#include <stddef.h>
int main (void)
{
int i, j=1;
char c;
printf("\nsize =%lu\n", sizeof(i+j));
|
by: pnreddy1976 |
last post by:
Hi,
How can we write a function, which functionality is similar to sizeof
function
any one send me source code
Reddy
|
by: Abhishek Srivastava |
last post by:
Hi,
Somebody recently asked me to implement the sizeof operator, i.e. to
write a function that accepts a parameter of any type, and without
using the sizeof operator, should be able to return...
|
by: Francois Grieu |
last post by:
Does this reliably cause a compile-time error
when int is not 4 bytes ?
enum { int_size_checked = 1/(sizeof(int)==4) };
Any better way to check the value of an expression
involving sizeof...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Aftab Ahmad |
last post by:
Hello Experts!
I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| |