![]() |
![]() |
#261 | |||||||||||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,351
|
Quote:
Quote:
The situation you describe isn't realistic, as with paged systems the 64-bit machine won't be allocating "3 to 7 GiB" to a 32-bit program... Quote:
![]() But no, the C90 program won't work completely unchanged - or if it does, it will be at the price of horrible performance costs. Quote:
Quote:
First, char is never 9-bit. What is sizeof(char) if it's 9-bit ?? If 1 then it can't be 9-bit, only 8. If 2, then it's 16-bit with 7 bits wasted. So, could be 16. But then if you do "*x" you access two bytes, not just one. Quote:
Quote:
Quote:
Quote:
In case you haven't noticed, time machines don't exist in real world. Quote:
Single-byte poke in comparison to string parse is an order of magnitude different. Will it be significant ? Actually, probably not. But you are tying your code down to a particular bit of hardware - by choosing PC model. You are also very limiting the possibilities. Consider using a proportional font, for example. And it is so easy to abstract text output by other means, this is becoming preposterous. Quote:
|
|||||||||||
![]() |
![]() |
#262 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,351
|
|
![]() |
![]() |
#263 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,302
|
It can perfectly be 9 bit, or 16 bit, or 32 bit, or 36 bit. That's not a problem for the "C virtual machine" (an entirely hypothetical machine the authors of ISO C came up with).
It's 1. Always. sizeof() doesn't measure the size in "octets" as there are machines that don't arrange memory in octets but in some other size. |
![]() |
![]() |
#264 | ||||||||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,302
|
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
There are reasons why there are companies that sell Linux, and companies that buy from them. Not to get the "IP" or the "copyright", but to be sure that the work is maintained, and guaranteed to operate on hardware that is certified for it. Quote:
I'm not clear what you're trying to say. As company, I don't care much about "public domain". A little bit of money is worth the investment into my products if I get something in return - "less worries", and somebody else that cares about. |
||||||||
![]() |
![]() |
#265 | ||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,351
|
Quote:
Quote:
Anyway, the point is : char is unsuitable for safely handling bytes. Do you at least agree on this ? |
||
![]() |
![]() |
#266 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,302
|
Unicode is an encoding, not a type. If you mean "wide characters", there is a wide character type wchar_t for encodings that require characters that are wider than char. "char" is not related to the selected encoding of text, it is just the smallest addressable unit on the virtual machine. Thus, yes, always. Depending on your definition of "byte", this is what the standard also says, just that "a byte" does not need to agree with "an octet". Thus, there are certainly existing processors, active in use, where char=short=int, and all have 16 bit.
|
![]() |
![]() |
#267 | ||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,351
|
Quote:
Not surprising from C, where 'x' is actually an int. Quote:
But maybe char is enough and __int8 is useless ? Then, not for general purpose use. It would be incredibly bad for interoperability. |
||
![]() |
![]() |
#268 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
|
![]() |
![]() |
#269 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,302
|
Unfortunately, it is. Or rather a historical accident, where "char" was, originally, of course the character type of the machine it run on, but this type of interpretation became problematic for some architectures the language was ported to.
For the machines we typically care about in this forum, it is 8 bit, yes. Not quite. int8 is 8 bit on machines where such a datatype exists. If it doesn't exist, then the hosting machine does not have an addressable 8 bit type, and if your algorithm depends on it, you know at least that you have to find some other solution. So it certainly does serve some purpose. These are typically not general purpose processors, but DSPs, indeed. However, with some pain, one can certainly program such chips, also in some portable way. C is a solution for such architectures. But then again, you wouldn't port your average word processor to such chips. They are designed for other purposes. |
![]() |
![]() |
#270 | ||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,351
|
Quote:
Quote:
This is what i wanted to show to the OP. Of course it derailed. |
||
![]() |
![]() |
#271 |
Registered User
Join Date: Feb 2017
Location: Denmark
Posts: 1,182
|
Yeah, this is getting into language lawyer territory, but "char" is better thought of as "minimally addressable" unit, which is usually 8 bits (it can not be less in C90 or later, you can check it with CHAR_BIT - the standard says: "maximum number of bits for smallest object that is not a bit-field (byte)").
Everyone that's not targeting weird DSP chips either just assumes CHAR_BIT==8, use e.g. uint8_t (or their own typedefs) or add compile/configure-time checks. @OP: Many pages back I said you might be better off just ignoring ANSI stuff, but now that I think I understand what you're trying to do, you may be better off embracing it (or using a curses like interface as others have suggested)! The reason I suggested ignoring it, is that not many original applications used it because it was slow, and thus maybe a distraction. You may find this article interesting regarding why it was slow. |
![]() |
![]() |
#272 | ||
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
|
Quote:
Quote:
I've never personally dealt with 9-bit chars myself so I don't know if I'm missing something that you are seeing. I do know that sizeof(char) is always 1 though, so that's not an issue. |
||
![]() |
![]() |
#273 | ||
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
|
Quote:
Quote:
You know, I think an argument can be made that all stops should be pulled out to ensure that the application is viable on an IBM PC XT. Everyone else has the grunt (or is of lesser importance) that they can convert from that model to the ANSI control characters or whatever else that they need. |
||
![]() |
![]() |
#274 | ||||||||||||||
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
|
Quote:
Quote:
Quote:
Quote:
And at this level, if you're worried about performance issues, the problem is not the 8086 segmentation model, the problem is you selected the 8086 instead of the 80286 or 80386 for the better clock speed rather than an architecture change. Quote:
AVON There is no known power in the universe that can operate a traction beam over that distance. TARRANT Just because you don't know how to build a high-energy traction beam doesn't mean that no one else knows how to build one. While ever the possibility of god(s) exist, and note that a majority of people in the world believe at least one exists, literally anything is possible. I don't know what you think Heaven/Hell may look like, but they could involve reliving life with your current knowledge. Trivial to do if we happen to be living inside a computer simulation already. You probably already believe quantum mechanics that allows for the possibility of spontaneous teleport. Science hasn't ruled out time travel either. Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
||||||||||||||
![]() |
![]() |
#275 |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
|
Not at all. C is basically portable assembler. What's the issue? Have you looked at the assembler code C compilers generate? It's beautiful. Although I've only looked at 16-bit and 32-bit register sizes. 8-bit is not a problem I'm dealing with at the moment.
|
![]() |
![]() |
#276 |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
|
|
![]() |
![]() |
#277 | |||||||||
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
|
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
|||||||||
![]() |
![]() |
#278 | |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
|
Quote:
Note that to support Vietnamese I'm planning on having a slightly modified VISCII - I have a different set of control characters I wish to relinquish to allow them to fit into 8 bits without disturbing *printable* ASCII. Chinese/Japanese/Korean I have no interest in at all. They can simply use their respective alphabets like everyone else does. So everything I want to do in 1983 and 1990 can be done in 8-bit chars, and machines with 9-bit chars are not an issue either. |
|
![]() |
![]() |
#279 | |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
|
Quote:
And the application I really want to run is micro-emacs, and it already has the equivalent of curses, and supports a flavor that accesses 0xb8000 and an ANSI version. So I can't see any technical barrier to the Amiga being a viable MSDOS machine in 1985, if we have cooperative programmers in 1983. And PDOS-generic would deliver that environment on top of the Amiga. You don't need Commodore's permission. And you can use Lattice C (SAS/C). So the only question remaining is - is there anything deficient about PDOS-generic's design before it gets released around 1986? |
|
![]() |
![]() |
#280 | |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
|
Quote:
void *Input(void); void *Output(void); void *Open(const char *fnm, long b); long Read(void *a, void *b, long c); long Write(void *a, void *b, long c); long Seek(void *a, long offs, long c); int Close(void *a); struct DateStamp *DateStamp(struct DateStamp *d); void *AllocMem(size_t a, long b); void FreeMem(void *a, size_t b); |
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
|
|