473,441 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,441 software developers and data experts.

Library bug or my fault?

Hi,

Please check the sample code listed in the end of the message. It was
compiled using ARM/Linux cross-compiler and run on an ARM9 target. I
think the problem applies to this group because two cross-compiler
from different vendor result same error. So I guess it is not vendor
specific. If my guess is right, then it means the code itself may get
problem, but I can not figure out where it is.

The problem is, the line 38 which copy 3 bytes, starting from p2, to
p1, but the immediately followed memcmp (line 42) shows the memcpy was
not well done. I am sure the memcpy did not do the job, since if I
provide my own memcpy implemention as below, the error will go
disappear.

void memcpy(void *dest, void *src, size_t n)
{
uint8_t *d = (uint8_t*)dest;
uint8_t *s = (uint8_t*)src;

for (size_t i = 0; i < n; ++i)
*d++ = *s++;
}

Could you please check the code as well as the running result and
tell me what wrong with it? Thanks.
------------------------------------- the minimum sample
--------------------------------------------------
1 #include <stdio.h>
2 #include <string>
3 #include <stdint.h>
4 #include <assert.h>
5
6 struct Foo {
7 uint8_t x;
8 uint8_t y;
9 uint8_t z;
10 uint8_t m[3];
11 };
12
13 struct Bar
14 {
15 uint8_t m[3];
16 };
17
18 void pr(const char *title, const void *block, size_t n)
19 {
20 printf("%s\n", title);
21
22 uint8_t *p = (uint8_t*)block;
23 for (size_t i = 0; i < n; ++i)
24 printf("0x%02x ", *p++);
25
26 printf("\n");
27 }
28
29 void cp(const Foo *foo)
30 {
31 Bar bar;
32
33 Bar *p1 = &bar;
34 Bar *p2 = (Bar*)(foo->m);
35 pr("before: p1:", p1, 3);
36 pr("before: p2:", p2, 3);
37
38 memcpy(p1, p2, 3);
39 pr("after: p1:", p1, 3);
40 pr("after: p2:", p2, 3);
41
42 if (memcmp(p1, p2, 3) != 0)
43 printf("!!! cp is wrong\n");
44 }
45
46 int main()
47 {
48 Foo foo;
49 foo.x = 1;
50 foo.y = 2;
51 foo.z = 3;
52 foo.m[0] = 0x40;
53 foo.m[1] = 0x19;
54 foo.m[2] = 0x21;
55
56 cp(&foo);
57 cp2(&foo);
58 return 0;
59 }
------------------------------------------------------------------

Below is the running output on an ARM920T board:

before: p1:
0xfc 0x01 0x12
before: p2:
0x40 0x19 0x21
after: p1:
0x40 0x01 0x02
after: p2:
0x40 0x19 0x21
!!! cp is wrong
Jul 22 '08
77 2092
In article <g6**********@registered.motzarella.org>,
Richard <rg****@gmail.comwrote:
>But meanwhile in the real world where efficiency and cost effective SW
development is important ...
....portability matters.

At my day job, we have both code written by standards-and-portability
weenies and code written by whatever-works types.

In terms of efficiency of the code, the standards-and-portability
weenies have a very slight advantage, since they fix their bugs
*before* the optimizer makes subtle bugs less subtle. But that's
barely noticeable at the best of times, and only a small amount of code
actually *needs* to run fast.

In terms of cost-effective development, any difference in productivity
between the standards-and-portability types and the whatever-works
types is completely lost in the effects of understanding of the problem
domain. (We have a lot of variability in the latter (in both the
problem domains and in who understands which ones how well), and it's
pretty much completely independent of the attitudes toward
portability.)
So for single-platform development, there's no detectable difference.
But now we're thinking of switching platforms.

The standards-and-portability weenies have already tested half the code
they've written on the platform we're thinking of switching to, since
that's what standards-and-portability weenies do. (Besides, some types
of problem are a lot easier to debug on that platform than on the one
we currently deploy on, so being able to run the code there already has
a nonnegative ROI.)
The whatever-works types have a whole bunch of code that has never been
compiled or run outside our current toolchain and deployment platform.

Which chunks of code do you think we're more likely to be able to get
running efficiently and cost-effectively on the new platform?
dave
(I don't expect Richard to provide any evidence of having gotten my
point, but it's worth pointing out for other readers.)

--
Dave Vandervies dj3vande at eskimo dot com
I have to go through 37 more source files of the original programmer.
He may well receive (posthumously) my thanks for making me a better
C programmer. --Nishad Prakash in comp.lang.c
Jul 22 '08 #51
Keith Thompson wrote:
>
Consider a hypothetical implementation with the following
characteristics:

CHAR_BIT == 8
sizeof(int) == 4 (32 bits)
INT_MIN == -8388608 (-2**23)
INT_MAX == +8388607 (+2**23-1)

Type int has 1 sign bit, 23 value bits, and 8 padding bits.

Storing the result of evaluating any arithmetic expression in an int
object causes the object's padding bits to be set to zero. (This can
be verified by interpreting the object's representation as an array of
unsigned char.) Evaluating the value of an object with non-zero
padding bits causes immediate termination of the program.
Such a system is possible... if you do not care about
practical considerations...
I know of no actual system that has the above characteristics; that's
not the point. I do not claim that such a system is likely to be
built in the future; that's not the point either (though there could
be legitimate reasons, reasons I haven't thought of, to build such a
system). The point is that such a system conforms to the C standard,
and there *could* be some future system that does exhibit the
characteristics I've described.
Yes. Something like that *could* exist.
Do you agree?
Yes.
If so, doesn't that contradict your statement about
padding bits being "masked by the hardware"?
You are not talking about padding bits. You are talking about
control bits that are similar to the parity bits in serial
transmissions. Padding bits exist for alignment reasons.
Parity/control bits/redundancy bits are not there just to take
space, they have redundancy objectives.
If you don't agree, why
not?
See above
I understand that you personally dislike the "regulars", of whom I am
one; as you wrote in another thread, "I am completely opposed to that
people". In replying to this, please try to get past your personal
animosity and respond to what I actually wrote.

I did, but it was quite an effort. Anyway discussions are quite
useless. What bothers me here is that in discussions of people
that ask simple questions, regulars *invent* machines that
*could* exist just to confuse people.

They like (as all pedants) displaying their great "C knowledge",
by inventing possible situations where this or that paragraph of
the standard could apply.

As a matter of fact (of course) they are AGAINST the C99 standard
that they try to disqualify at each post. But they pose as
if they were for Standard C.

That is the AS IF rule!
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Jul 22 '08 #52
jacob navia <ja***@nospam.comwrites:
Keith Thompson wrote:
>Consider a hypothetical implementation with the following
characteristics:
CHAR_BIT == 8
sizeof(int) == 4 (32 bits)
INT_MIN == -8388608 (-2**23)
INT_MAX == +8388607 (+2**23-1)
Type int has 1 sign bit, 23 value bits, and 8 padding bits.
Storing the result of evaluating any arithmetic expression in an int
object causes the object's padding bits to be set to zero. (This can
be verified by interpreting the object's representation as an array of
unsigned char.) Evaluating the value of an object with non-zero
padding bits causes immediate termination of the program.

Such a system is possible... if you do not care about
practical considerations...
As a practical consideration, it's possible that some future system,
or perhaps some relatively exotic system that already exists that
neither of us happens to be familiar with, could have exactly the
characteristics I mentioned above, or something very similar.

I think I may actually have worked on a system that has padding bits
in some integer types. I didn't happen to do anything that was
affected by this, and I didn't check the values from <limits.hwhile
I still had access to the system, so I can't be sure. The system was
a Cray T90; I'm fairly sure that it or some of its predecessors used
something like 24 out of 64 bits for some integer types. If I can get
access to a Cray again, I'll check it out.

The T90 is admittedly a fairly old system, and there are probably only
a few of them still in service. But they're not *that* old; the first
were shipped in 1995. And the reason for the odd behavior was a very
strong emphasis on floating-point over integer arithmetic, something
that could very well be a decisive factor for some future systems.

In any case, I actually find it *easier* in most cases to write code
that depends only on what's guaranteed by the standard.
>I know of no actual system that has the above characteristics; that's
not the point. I do not claim that such a system is likely to be
built in the future; that's not the point either (though there could
be legitimate reasons, reasons I haven't thought of, to build such a
system). The point is that such a system conforms to the C standard,
and there *could* be some future system that does exhibit the
characteristics I've described.

Yes. Something like that *could* exist.
>Do you agree?

Yes.
Excellent.
>If so, doesn't that contradict your statement about
padding bits being "masked by the hardware"?

You are not talking about padding bits. You are talking about
control bits that are similar to the parity bits in serial
transmissions. Padding bits exist for alignment reasons.
Parity/control bits/redundancy bits are not there just to take
space, they have redundancy objectives.
Yes, I certainly am talking about padding bits. I asked you to read
C99 6.2.6.2. Please read it again. It explains quite clearly what
padding bits are.

To be clear, parity bits that aren't visible to software are not
padding bits. Padding bits, as defined by the standard, exist only
for integer types; they're bits that are part of the type's
representation (and can therefore be seen if you view the type as an
array of unsigned char) but do not contribute to its value.

Padding *bytes* are used for alignment in structures; they're
mentioned in C99 6.2.6.1.
>If you don't agree, why
not?

See above
>I understand that you personally dislike the "regulars", of whom I am
one; as you wrote in another thread, "I am completely opposed to that
people". In replying to this, please try to get past your personal
animosity and respond to what I actually wrote.

I did, but it was quite an effort.
It should become easier with practice. Seriously.
Anyway discussions are quite
useless. What bothers me here is that in discussions of people
that ask simple questions, regulars *invent* machines that
*could* exist just to confuse people.
No, we invent machines that could exist to illustrate the wide variety
of machines that are possible, and to encourage programmers to think
about portability when they write code.
They like (as all pedants) displaying their great "C knowledge",
by inventing possible situations where this or that paragraph of
the standard could apply.

As a matter of fact (of course) they are AGAINST the C99 standard
that they try to disqualify at each post. But they pose as
if they were for Standard C.
I am not against the C99 standard. Where have I said that I am?
That is the AS IF rule!
No, it isn't.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jul 22 '08 #53
jacob navia said:
Keith Thompson wrote:
>>
Consider a hypothetical implementation with the following
characteristics:

CHAR_BIT == 8
sizeof(int) == 4 (32 bits)
INT_MIN == -8388608 (-2**23)
INT_MAX == +8388607 (+2**23-1)

Type int has 1 sign bit, 23 value bits, and 8 padding bits.

Storing the result of evaluating any arithmetic expression in an int
object causes the object's padding bits to be set to zero. (This can
be verified by interpreting the object's representation as an array of
unsigned char.) Evaluating the value of an object with non-zero
padding bits causes immediate termination of the program.

Such a system is possible... if you do not care about
practical considerations...
I certainly hope that nobody would ever design such a system by choice, so
presumably such a system would only ever be designed *because* of
practical considerations.

Oops, I nearly gave another picturesque analogy. A good one, too. But
what's the point?

<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 23 '08 #54
Nick Keighley wrote:
Peter Nilsson <ai...@acay.com.auwrote:
Steven Woody wrote:
The problem is, the line 38 which copy 3 bytes, starting from
p2, to p1, but the immediately followed memcmp (line 42)
shows the memcpy was not well done.
It's the lines before that signal a problem.
------------------------------------- the minimum sample
--------------------------------------------------
1 #include <stdio.h>
2 #include <string>
3 #include <stdint.h>
4 #include <assert.h>
5
6 struct Foo {
7 � � uint8_t x;
8 � � uint8_t y;
9 � � uint8_t z;
10 � � uint8_t m[3];
11 };
12
13 struct Bar
14 {
15 � � uint8_t m[3];
16 };
These are completely different structs.

yes, so?
So conversion of an address of one (not the first) struct member
into a pointer to another struct is already suspicious.
29 void cp(const Foo *foo)
30 {
31 � � Bar bar;
32
33 � � Bar *p1 = &bar;
34 � � Bar *p2 = (Bar*)(foo->m);
The fact you have a cast to silence a warning (or more likely
error) on incompatible types is the problem. Bar is not an array,
it is a struct containing an array.

yes, but there can't be padding at the beginning of a struct
Irrelevant. The m being copied is in the middle of a Foo. Given
that it isn't a Bar, why should a pointer to that be portably
convertable to a pointer to Bar?
hence Bar.m and Bar must be at the same address.
As my suggestion went on to show, there is clearly no problem
copying an array to an array of the same type and size directly.
But for no obvious reason, the code avoids that simple course.
Also uint8_t is probably (almost certainly) an alias (typedef)
for unsigned char and you can safely cast *anything* to
unsigned char
Again, irrelevant. There is no conversion to unsigned char
anywhere in the code quoted above.
I'd say this pretty well had to work (do you have a compiler where
it doesn't work?)
The OP has a compiler where the code doesn't work. I don't know
why the compiler's doing what it's doing, I merely know that, on the
basis of what's been posted, neither the compiler nor the library
can be said to be at fault.
The standard allows the conversion (if foo->m is aligned
properly),

why would foo->m not be correctly aligned?
Because any struct can have alignment requirements that are stricter
than the elements it contains.

Can you state any reasons why an implementation couldn't pad
a 3 byte structure to 4 bytes size and alignment?

--
Peter
Jul 23 '08 #55
On Mon, 21 Jul 2008 23:46:07 -0700 (PDT), Steven Woody
<na********@gmail.comwrote:
>Hi,

Please check the sample code listed in the end of the message. It was
compiled using ARM/Linux cross-compiler and run on an ARM9 target. I
think the problem applies to this group because two cross-compiler
from different vendor result same error. So I guess it is not vendor
specific. If my guess is right, then it means the code itself may get
problem, but I can not figure out where it is.

The problem is, the line 38 which copy 3 bytes, starting from p2, to
p1, but the immediately followed memcmp (line 42) shows the memcpy was
not well done. I am sure the memcpy did not do the job, since if I
provide my own memcpy implemention as below, the error will go
disappear.

void memcpy(void *dest, void *src, size_t n)
{
uint8_t *d = (uint8_t*)dest;
Why do you have a cast here?
uint8_t *s = (uint8_t*)src;

for (size_t i = 0; i < n; ++i)
What is the guarantee that n is never larger that sizeof(uint8_t)?
*d++ = *s++;
}

Could you please check the code as well as the running result and
tell me what wrong with it? Thanks.
------------------------------------- the minimum sample
--------------------------------------------------
1 #include <stdio.h>
2 #include <string>
You need to post your real code using cut and paste. Retyping just
introduces other errors confusing everyone.
>3 #include <stdint.h>
4 #include <assert.h>
5
6 struct Foo {
7 uint8_t x;
8 uint8_t y;
9 uint8_t z;
10 uint8_t m[3];
11 };
12
13 struct Bar
14 {
15 uint8_t m[3];
16 };
17
18 void pr(const char *title, const void *block, size_t n)
19 {
20 printf("%s\n", title);
21
22 uint8_t *p = (uint8_t*)block;
This cast removes the const attribute. You should add it back by
fixing the definition of p. Otherwise, there is no point in having in
the function definition at all.
>23 for (size_t i = 0; i < n; ++i)
24 printf("0x%02x ", *p++);
25
26 printf("\n");
27 }
28
29 void cp(const Foo *foo)
30 {
31 Bar bar;
32
33 Bar *p1 = &bar;
34 Bar *p2 = (Bar*)(foo->m);
35 pr("before: p1:", p1, 3);
36 pr("before: p2:", p2, 3);
37
38 memcpy(p1, p2, 3);
39 pr("after: p1:", p1, 3);
40 pr("after: p2:", p2, 3);
41
42 if (memcmp(p1, p2, 3) != 0)
43 printf("!!! cp is wrong\n");
After making the obvious tweaks for C89, the code ran exactly as
expected on my system and never printed this message. By any chance
does your actual code have a ; after the if?
>44 }
45
46 int main()
47 {
48 Foo foo;
49 foo.x = 1;
50 foo.y = 2;
51 foo.z = 3;
52 foo.m[0] = 0x40;
53 foo.m[1] = 0x19;
54 foo.m[2] = 0x21;
55
56 cp(&foo);
57 cp2(&foo);
58 return 0;
59 }
------------------------------------------------------------------

Below is the running output on an ARM920T board:

before: p1:
0xfc 0x01 0x12
before: p2:
0x40 0x19 0x21
after: p1:
0x40 0x01 0x02
after: p2:
0x40 0x19 0x21
!!! cp is wrong

Remove del for email
Jul 23 '08 #56
In article <ln************@nuthaus.mib.orgKeith Thompson <ks***@mib.orgwrites:
....
I think I may actually have worked on a system that has padding bits
in some integer types. I didn't happen to do anything that was
affected by this, and I didn't check the values from <limits.hwhile
I still had access to the system, so I can't be sure. The system was
a Cray T90; I'm fairly sure that it or some of its predecessors used
something like 24 out of 64 bits for some integer types. If I can get
access to a Cray again, I'll check it out.
24 bits was used for 'short' and as a compiler option for 'int'. But
'int' itself was only 48 bits out of 64. And if the upper 16 bits were
not all zero you could get a big surprise when multiplying such things.

(When not all 16 bits of both operands were zero the multiplying unit
would assume that the operands were floating point and operate
accordingly.)
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
Jul 23 '08 #57
"Dik T. Winter" <Di********@cwi.nlwrites:
In article <ln************@nuthaus.mib.orgKeith Thompson
<ks***@mib.orgwrites:
...
I think I may actually have worked on a system that has padding bits
in some integer types. I didn't happen to do anything that was
affected by this, and I didn't check the values from <limits.hwhile
I still had access to the system, so I can't be sure. The system was
a Cray T90; I'm fairly sure that it or some of its predecessors used
something like 24 out of 64 bits for some integer types. If I can get
access to a Cray again, I'll check it out.

24 bits was used for 'short' and as a compiler option for 'int'. But
'int' itself was only 48 bits out of 64. And if the upper 16 bits were
not all zero you could get a big surprise when multiplying such things.

(When not all 16 bits of both operands were zero the multiplying unit
would assume that the operands were floating point and operate
accordingly.)
Thanks.

There was never a C99 compiler for the Cray T90, and the concepts of
"padding bits" and "trap representations" were introduced by C99.

However, we have demonstrated by example a fairly recent system (still
in production use within the last 10 years) on which integer types can
have bits that don't contribute to the value, but which are not
ignored, resulting in incorrect results if those bits take on certain
values. This admittedly odd design was not implemented for the fun of
it; it was done for perfectly valid reasons.

And it's entirely plausible that something similar could show up in a
future design.

jacob would have us pretend that this just isn't possible. It's
basically the same thing as the old "All the world's a VAX" syndrome,
or its modern equivalent the "All the world's an x86" syndrome.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jul 23 '08 #58
On 22 Jul 2008 at 16:57, Ike Naar wrote:
In article <g6**********@aioe.org>, jacob navia <ja***@nospam.orgwrote:
>>But since you can't point me to ANY such machine now, I strongly
suspect that when discussing problems in C programming TODAY we should
NOT confuse everyone with obsolete machines.

My only point was to illustrate that machines, that you claimed only exist
"in the minds of the regulars" exist elsewhere too.
It's really very simple. If someone has a question about programming in
C on a mainframe from the stone-age with trap representations and the
like, or if they're programming an embedded system with 16-bit chars and
half the standard library missing, then all they have to do is make that
clear from the beginning, and then that will be the context for that
thread.

Otherwise, doesn't it make sense to work on the assumption that they're
part of the 99.9% of the world using a modern operating system on modern
hardware? Anywhere apart from in the autistic heart of clc that wouldn't
be controversial in the slightest, merely basic common sense.

Jul 26 '08 #59
Antoninus Twink wrote:
On 22 Jul 2008 at 16:57, Ike Naar wrote:
>In article <g6**********@aioe.org>, jacob navia <ja***@nospam.orgwrote:
>>But since you can't point me to ANY such machine now, I strongly
suspect that when discussing problems in C programming TODAY we should
NOT confuse everyone with obsolete machines.
My only point was to illustrate that machines, that you claimed only exist
"in the minds of the regulars" exist elsewhere too.

It's really very simple. If someone has a question about programming in
C on a mainframe from the stone-age with trap representations and the
like, or if they're programming an embedded system with 16-bit chars and
half the standard library missing, then all they have to do is make that
clear from the beginning, and then that will be the context for that
thread.

Otherwise, doesn't it make sense to work on the assumption that they're
part of the 99.9% of the world using a modern operating system on modern
hardware? Anywhere apart from in the autistic heart of clc that wouldn't
be controversial in the slightest, merely basic common sense.
Please do not speak about "common sense" here. It is not mentioned
in the C standard of 1989.

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Jul 26 '08 #60
In article <g6**********@aioe.org>, jacob navia <ja***@nospam.orgwrote:
>Antoninus Twink wrote:
>Otherwise, doesn't it make sense to work on the assumption that they're
part of the 99.9% of the world using a modern operating system on modern
hardware? Anywhere apart from in the autistic heart of clc that wouldn't
be controversial in the slightest, merely basic common sense.

Please do not speak about "common sense" here. It is not mentioned
in the C standard of 1989.
tou-freakin-che'! :)
--
Greg Comeau / 4.3.10.1 with C++0xisms now in beta!
Comeau C/C++ ONLINE == http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Jul 26 '08 #61
Antoninus Twink wrote:
On 22 Jul 2008 at 16:57, Ike Naar wrote:
>In article <g6**********@aioe.org>, jacob navia <ja***@nospam.org>
wrote:
>>>But since you can't point me to ANY such machine now, I strongly
suspect that when discussing problems in C programming TODAY we
should NOT confuse everyone with obsolete machines.

My only point was to illustrate that machines, that you claimed only
exist "in the minds of the regulars" exist elsewhere too.

It's really very simple. If someone has a question about programming
in C on a mainframe from the stone-age with trap representations and
the like, or if they're programming an embedded system with 16-bit
chars and half the standard library missing, then all they have to do
is make that clear from the beginning, and then that will be the
context for that thread.

Otherwise, doesn't it make sense to work on the assumption that
they're part of the 99.9% of the world using a modern operating system
on modern hardware? Anywhere apart from in the autistic heart of clc
that wouldn't be controversial in the slightest, merely basic common
sense.
When a poster makes non-portable assumptions in his source code, it
makes sense to bring them to notice, since tomorrow that code may have
to be ported to systems where those assumptions are no longer valid.

If a poster is absolutely certain that his code will be confined only to
certain systems, then IMO, it makes more sense for that poster to take
full advantage of extensions offered by his set of platforms and
perhaps post in groups specifically set aside for them.

Jul 27 '08 #62
jacob navia <ja***@nospam.comwrites:
Yes, it is not IMPOSSIBLE that somewhere in the planet, there is still some
B6700 running around using floating point for integers... who
knows?
Unisys is still selling mainframes using descendants of this architecture
(as well as mainframes using descendant of Unix 1100, which are ones
complement machine).

How much C programming is done on them, that's another question.

But if you consider the host of strange embedded architectures that exists
out it the wild -- most of them you'll be aware of only if you are in the
company making them -- I'd be surprised if there is currently none of them
with a C compiler and trap integer representations. On another variance
axis, XKL considers usefull to maintain a port of gcc for the PDP-10, a 36
bits, word adressable machine DEC announced the cancellation 25 years ago
(see http://gcc.gnu.org/ml/gcc/2008-04/msg00506.html).

Yours,

--
Jean-Marc
Jul 27 '08 #63
Jean-Marc Bourguet wrote:
jacob navia <ja***@nospam.comwrites:
>Yes, it is not IMPOSSIBLE that somewhere in the planet, there is still some
B6700 running around using floating point for integers... who
knows?

Unisys is still selling mainframes using descendants of this architecture
(as well as mainframes using descendant of Unix 1100, which are ones
complement machine).

How much C programming is done on them, that's another question.

But if you consider the host of strange embedded architectures that exists
out it the wild -- most of them you'll be aware of only if you are in the
company making them -- I'd be surprised if there is currently none of them
with a C compiler and trap integer representations. On another variance
axis, XKL considers usefull to maintain a port of gcc for the PDP-10, a 36
bits, word adressable machine DEC announced the cancellation 25 years ago
(see http://gcc.gnu.org/ml/gcc/2008-04/msg00506.html).

Yours,
That is why we have to tell this to people that wouldn't care less when
they ask a question here. So that we can display our knowledge to them.
UNISYS: They market mainframes. Yes. For instance the MCP "Clear path"
series:

http://www.unisys.com/products/mainf...ames/index.htm
<quote>
Mid-range MCP systems: Libra Model 400 Server
Libra Model 400 Servers are fully featured, entry and mid-range
mainframe systems for MCP environments. These new servers are based on
the ClearPath Next-Generation Server Architecture and feature quad-core
Intel processors running both MCP and Windows operating systems.
<end quote>

Another product line, the OS2000 series:
<quote>

http://www.unisys.com/products/mainf...ames/index.htm
New Next-Generation OS 2200 Servers: Dorado 400 Series

The ClearPath Dorado 400 Series is the first Dorado family of servers
based on the ClearPath Next-Generation Server Architecture. These
entry-level servers run the OS 2200 operating system on Intel® processors.
<end quote>

Those are the two main lines of UNISYS sold TODAY!
-----------------------------------------------------------------------------

As for the unix 1100 that you mention, that product line started as
follows:
1. UNIVAC 1107 introduced in 1962
2. UNIVAC 1108 introduced in 1965
3. UNIVAC 1106 introduced in 1969
4. UNIVAC 1110 introduced in 1970
5. UNIVAC 1100/10 redesignation of UNIVAC 1106 in 1975
6. UNIVAC 1100/20 redesignation of UNIVAC 1108 in 1975
7. UNIVAC 1100/40 redesignation of UNIVAC 1110 in 1975
8. UNIVAC 1100/80 introduced in 1975
9. UNIVAC 1100/80A introduced in 1977
10. UNIVAC 1100/60 introduced in 1979
11. UNIVAC 1100/70 introduced in 1981
12. UNIVAC 1100/90 introduced in 1982

And there it STOPS! 26 YEARS AGO.
---------------------------------------------------------------------------

That is why we have to tell people asking questions here about that. It
is ESSENTIAL that they know the problems they *could* have if they port
their software to an UNISYS mainframe emulator running in their windows
machine!
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Jul 27 '08 #64
jacob navia <ja***@nospam.comwrites:
Jean-Marc Bourguet wrote:
>jacob navia <ja***@nospam.comwrites:
>>Yes, it is not IMPOSSIBLE that somewhere in the planet, there is still some
B6700 running around using floating point for integers... who
knows?

Unisys is still selling mainframes using descendants of this architecture
(as well as mainframes using descendant of Unix 1100, which are ones
complement machine).

How much C programming is done on them, that's another question.

But if you consider the host of strange embedded architectures that exists
out it the wild -- most of them you'll be aware of only if you are in the
company making them -- I'd be surprised if there is currently none of them
with a C compiler and trap integer representations. On another variance
axis, XKL considers usefull to maintain a port of gcc for the PDP-10, a 36
bits, word adressable machine DEC announced the cancellation 25 years ago
(see http://gcc.gnu.org/ml/gcc/2008-04/msg00506.html).

Yours,

That is why we have to tell this to people that wouldn't care less when
they ask a question here. So that we can display our knowledge to them.
I'm not the one who started to write about that, I'm just adding some
information.
UNISYS: They market mainframes. Yes. For instance the MCP "Clear path"
series:

Another product line, the OS2000 series:
Those are the two main lines of UNISYS sold TODAY!
Yes, but you seem to have missed that the 2200 series is a direct
descendant, still backward compatible, of the 1107 Univac, and the MCP is a
direct descendant, still backward compatible, of the Burrough B6500.

Yours,

--
Jean-Marc
Jul 27 '08 #65
jacob navia wrote:
Jean-Marc Bourguet wrote:
>jacob navia <ja***@nospam.comwrites:
>>Yes, it is not IMPOSSIBLE that somewhere in the planet, there is
still some B6700 running around using floating point for integers...
who knows?

Unisys is still selling mainframes using descendants of this
architecture (as well as mainframes using descendant of Unix 1100,
which are ones complement machine).
[ ... ]
That is why we have to tell this to people that wouldn't care less
when they ask a question here. So that we can display our knowledge to
them.
[ ... ]
That is why we have to tell people asking questions here about that.
It is ESSENTIAL that they know the problems they *could* have if they
port their software to an UNISYS mainframe emulator running in their
windows machine!
As long as the Standard recognises the possibility of trap
representations, then maximally portable code has to take it into
account. It doesn't matter whether actual machines exist. It matters
that the language Standard allows for the possibility in it's abstract
machine model. A maximally portable program should be able to run and
produce correct output on a theoretical implementation that implements
every possible feature specified by ISO C.

Given the "quality" of most "C/C++" web forums, you should be glad that
a high quality group like this still exists. After all, you have, on
numerous occasions, had your own questions and misunderstandings
cleared through this group (and comp.std.c).

Jul 27 '08 #66

"santosh" <sa*********@gmail.comwrote in message
news:g6**********@registered.motzarella.org...
Antoninus Twink wrote:
>Otherwise, doesn't it make sense to work on the assumption that
they're part of the 99.9% of the world using a modern operating system
on modern hardware? Anywhere apart from in the autistic heart of clc
that wouldn't be controversial in the slightest, merely basic common
sense.

When a poster makes non-portable assumptions in his source code, it
makes sense to bring them to notice, since tomorrow that code may have
to be ported to systems where those assumptions are no longer valid.
Would it be possible for someone to design a new computer system that would
break a C program that is otherwise 100% portable today and adheres to
everything in the Standard?

And I mean a general purpose machine not something specifically concocted to
break C.

--
Bartc

Jul 27 '08 #67
Bartc wrote:
>
"santosh" <sa*********@gmail.comwrote in message
news:g6**********@registered.motzarella.org...
>Antoninus Twink wrote:
>>Otherwise, doesn't it make sense to work on the assumption that
they're part of the 99.9% of the world using a modern operating
system on modern hardware? Anywhere apart from in the autistic heart
of clc that wouldn't be controversial in the slightest, merely basic
common sense.

When a poster makes non-portable assumptions in his source code, it
makes sense to bring them to notice, since tomorrow that code may
have to be ported to systems where those assumptions are no longer
valid.

Would it be possible for someone to design a new computer system that
would break a C program that is otherwise 100% portable today and
adheres to everything in the Standard?
Yes. If the system is unable to support a conforming implementation of
ISO C.

However the Committee has taken substantial care in keeping the
requirements of C as low as is feasible, so that ISO C can be
implemented on as broad a variety of machines as possible. Naturally
such an effort is likely to introduce some complexity that many people
will consider as unnecessary.
And I mean a general purpose machine not something specifically
concocted to break C.
I am not aware of "general purpose" machines, but some embedded systems
are unable to support a hosted implementation, and I wouldn't be
surprised to hear of some that cannot support a conforming freestanding
one either, though I don't know of any examples.

But the point is this. It's *very* easy to write C code that has
numerous subtle portability problems. This needn't be done
deliberately, but simply because most C programmers do not (perhaps
understandably) understand all the ins-and-outs of Standard C. In fact
many do not even know that a Standard (and a public draft of it)
exists. I can attest to this personally. My own C code of say five
years ago has many more non-portable constructs and assumptions than
that of today. I credit the improvement to this group. Web forums are
great for help, yes, but in my experience they do not have the kind of
expertise on *Standard* C that clc and csc have. That's why it's worth
maintaining the high levels of standard that this group still has.

Jul 27 '08 #68
"Bartc" <bc@freeuk.comwrites:
"santosh" <sa*********@gmail.comwrote in message
news:g6**********@registered.motzarella.org...
>Antoninus Twink wrote:
>>Otherwise, doesn't it make sense to work on the assumption that
they're part of the 99.9% of the world using a modern operating system
on modern hardware? Anywhere apart from in the autistic heart of clc
that wouldn't be controversial in the slightest, merely basic common
sense.

When a poster makes non-portable assumptions in his source code, it
makes sense to bring them to notice, since tomorrow that code may have
to be ported to systems where those assumptions are no longer valid.

Would it be possible for someone to design a new computer system that would
break a C program that is otherwise 100% portable today and adheres to
everything in the Standard?
Answering that would need an exhaustive knowledge about existing
implementation that probably nobody has.
And I mean a general purpose machine not something specifically concocted
to break C.
BTW, there is quite a big space between a general purpose machine and
something specifically concocted to break C.

And don't forget the tendency in optimizer to use whatever room the
standard leave them in creative ways.

Yours,

--
Jean-Marc
Jul 27 '08 #69
On 27 Jul 2008 at 12:56, santosh wrote:
Yes. If the system is unable to support a conforming implementation of
ISO C.
Wonderful. So now we're meant to worry about portability to hardware
that can't even support an implementation of C. Should we also spend our
time fretting about whether our code is maximally portable enough to
keep working when the hardware melts down in a nuclear winter?

Jul 27 '08 #70
Antoninus Twink wrote:
On 27 Jul 2008 at 12:56, santosh wrote:
>Yes. If the system is unable to support a conforming implementation
of ISO C.

Wonderful. So now we're meant to worry about portability to hardware
that can't even support an implementation of C.
You have extracted my statement from it's context. Here it is, for the
benefit of anyone who might take Antoninus's post seriously:

Bartc wrote:
Would it be possible for someone to design a new computer system that
would break a C program that is otherwise 100% portable today and
adheres to everything in the Standard?

I replied:
Yes. If the system is unable to support a conforming implementation of
ISO C.

<snip>

Jul 27 '08 #71
santosh <sa*********@gmail.comwrites:
Antoninus Twink wrote:
>On 27 Jul 2008 at 12:56, santosh wrote:
>>Yes. If the system is unable to support a conforming implementation
of ISO C.

Wonderful. So now we're meant to worry about portability to hardware
that can't even support an implementation of C.

You have extracted my statement from it's context. Here it is, for the
benefit of anyone who might take Antoninus's post seriously:
Santosh. Stop. Think.

You said something very silly. If the C implementation on that HW is not
confirming then any "conforming C" is obviously not guaranteed
regardless.
Jul 27 '08 #72
santosh wrote:
Here it is, for the
benefit of anyone who might take Antoninus's post seriously:
Why do you continue to feed the troll?


Brian
Jul 27 '08 #73
In article <12****************@proxy00.news.clara.net>,
Ike Naar <ik*@localhost.claranet.nlwrote:
....
>According to the stats you're in the top 10 list of frequent posters
in this group. Could that mean you are a regular yourself?
Just curious :-)

Ike
The real question is: Who are you, "Ike"?

Jul 27 '08 #74
In article <g6**********@news.xmission.com>,
Kenny McCormack <ga*****@xmission.xmission.comwrote:
>The real question is: Who are you, "Ike"?
It's my real name. Please don't put quotes around it.
Jul 28 '08 #75
Ike Naar said:
In article <g6**********@news.xmission.com>,
Kenny McCormack <ga*****@xmission.xmission.comwrote:
>>The real question is: Who are you, "Ike"?

It's my real name. Please don't put quotes around it.
Asking trolls to behave civilly is like asking teenagers not to scratch the
paintwork on your car. Your prospect of success is practically zero, and
the more likely outcome by far is that they will try to behave still less
well.

I would imagine that the reason for McCormack/Twink/Riley attempting to
cast doubt on your identity is that he - sorry, *they* can't imagine that
more than one person would hold a view contrary to his - sorry, *their* -
own.

Don't let him - sorry, *them* - get to you. That's what killfiles are for.
:-)

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 28 '08 #76
santosh <sa*********@gmail.comwrites:
Antoninus Twink wrote:
>On 27 Jul 2008 at 12:56, santosh wrote:
>>Yes. If the system is unable to support a conforming implementation
of ISO C.

Wonderful. So now we're meant to worry about portability to hardware
that can't even support an implementation of C.

You have extracted my statement from it's context.
[...]

Of *course* he has. He's a troll. Please don't feed him.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jul 28 '08 #77
Richard wrote:
santosh <sa*********@gmail.comwrites:
>Antoninus Twink wrote:
>>On 27 Jul 2008 at 12:56, santosh wrote:
>>>Yes. If the system is unable to support a conforming implementation
of ISO C.

Wonderful. So now we're meant to worry about portability to hardware
that can't even support an implementation of C.

You have extracted my statement from it's context. Here it is, for
the benefit of anyone who might take Antoninus's post seriously:
I notice that you too have, like your friend Twink, snipped all the
context I provided.
Santosh. Stop. Think.

You said something very silly. If the C implementation on that HW is
not confirming then any "conforming C" is obviously not guaranteed
regardless.
The enemy of my enemy is my friend eh?

Jul 29 '08 #78

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Glenn C. Rhoads | last post by:
I'm having a problem calling a C function from a publicly available library file. To get the code to compile, I had to declare the function as an external C function as follows. extern "C"...
1
by: Adman | last post by:
I am experiencing a library issue that appears to be environment related but cannot isolate the cause. I would greatly appreciate any assistance anyone could provide. Apologies for the length but...
0
by: Matt S | last post by:
Hello, I'm trying to build a C# client to consume an AXIS Web Service (running SOAP over HTTP). The Web Service encodes full server-side exception traces in the Soap Fault > Detail element...
44
by: Jeff | last post by:
Hi I have a library mde that is used with some customer databases and I found out that another developer discovered it while doing some maintenance work on an old database for the same customer...
2
by: google | last post by:
I statically link the Synopsys Milkyway C-API library ("MDA") into my C++ application. When my C++ application throws an exception, it seg faults instead. The details of my environment are:...
1
by: quantass | last post by:
The webpage attempts to display a dropdown menu making heavy use of CSS and <UL>, <LI> tags. From my investigation, the standard CSS Hover pseudo attrib is being used, which I figure is the reason...
3
by: madunix | last post by:
My Server is suffering bad lag (High Utlization) I am running on that server Oracle10g with apache_1.3.35/ php-4.4.2 Web visitors retrieve data from the web by php calls through oci cobnnection...
3
by: =?Utf-8?B?TWFucHJlZXQgU3VzaGls?= | last post by:
I am having a Webservice within which i am throwing SOAP Exceptions and therefore whenever something wrong happens a SOAP fault comes up in the response - see below: <?xml version="1.0"...
2
by: Jun | last post by:
I'm running on 2.2 Kernel on a PPC platform and getting an intermttent seg fault on one of my threads. I have a spin loop after it detected the seg fault and after I loaded GDB and did a trace, I...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.