473,498 Members | 1,704 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

re-definition of standard types

Hello, All!

I often come across in open-source software definitions of standard types
with new names, for example:

typedef char SYS_CHAR;
typedef unsigned short SYS_UINT16;
....

Why not to use types specified in C99 or Posix standards? I believe that's
what they are for: make code reading/maintaining easier, standard and
consistent.

With best regards, Roman Mashak. E-mail: mr*@tusur.ru
Oct 27 '06 #1
9 1563
Roman Mashak wrote:
Hello, All!

I often come across in open-source software definitions of standard types
with new names, for example:

typedef char SYS_CHAR;
typedef unsigned short SYS_UINT16;
...

Why not to use types specified in C99 or Posix standards? I believe that's
what they are for: make code reading/maintaining easier, standard and
consistent.
Because some people feel the need to have types that are "guaranteed"
to be of a certain length or precision under the false assumption that
it makes their code more portable.

Regards,
Bart.

Oct 27 '06 #2
Roman Mashak wrote:
Hello, All!

I often come across in open-source software definitions of standard types
with new names, for example:

typedef char SYS_CHAR;
typedef unsigned short SYS_UINT16;
...

Why not to use types specified in C99 or Posix standards?
One possibility is to make the code easier to port to platforms that
don't conform to C99 or POSIX (most Windows implementations, for
example).

Oct 27 '06 #3
BRG
Bart wrote:
Roman Mashak wrote:
>Hello, All!

I often come across in open-source software definitions of standard types
with new names, for example:

typedef char SYS_CHAR;
typedef unsigned short SYS_UINT16;
...

Why not to use types specified in C99 or Posix standards? I believe that's
what they are for: make code reading/maintaining easier, standard and
consistent.

Because some people feel the need to have types that are "guaranteed"
to be of a certain length or precision under the false assumption that
it makes their code more portable.
Their assumption will not always be false.

Brian Gladman
Oct 27 '06 #4
"BRG" <br*@nowhere.orgwrote in message news
Bart wrote:
>Roman Mashak wrote:
>>Hello, All!

I often come across in open-source software definitions of standard
types
with new names, for example:

typedef char SYS_CHAR;
typedef unsigned short SYS_UINT16;
...

Why not to use types specified in C99 or Posix standards? I believe
that's
what they are for: make code reading/maintaining easier, standard and
consistent.

Because some people feel the need to have types that are "guaranteed"
to be of a certain length or precision under the false assumption that
it makes their code more portable.

Their assumption will not always be false.
No. If you've got a really brilliant configuration mangement system in place
then redefining every basic type can allow for clean recompiles.

The vast majority of people don't, in which case type such as SYS_CHAR
become a real nuisance. You must never call a standard library function with
a SYS_CHAR *, for example, or the whole system will break.
--
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.
Oct 28 '06 #5
BRG
Malcolm wrote:
"BRG" <br*@nowhere.orgwrote in message news
>Bart wrote:
>>Roman Mashak wrote:
Hello, All!

I often come across in open-source software definitions of standard
types
with new names, for example:

typedef char SYS_CHAR;
typedef unsigned short SYS_UINT16;
...

Why not to use types specified in C99 or Posix standards? I believe
that's
what they are for: make code reading/maintaining easier, standard and
consistent.
Because some people feel the need to have types that are "guaranteed"
to be of a certain length or precision under the false assumption that
it makes their code more portable.
Their assumption will not always be false.
No. If you've got a really brilliant configuration mangement system in place
then redefining every basic type can allow for clean recompiles.
The vast majority of people don't, in which case type such as SYS_CHAR
become a real nuisance. You must never call a standard library function with
a SYS_CHAR *, for example, or the whole system will break.
The original poster claimed that the redefinition of types to obtain
types of guaranteed length or precision was based on the false
assumption that this makes their code more portable.

I pointed out _only_ that their assumption would not _always_ be false.

I am confused by your post because you respond 'No' to this point but
then go on to give details that are inconsistent with this response.

Brian Gladman
Oct 28 '06 #6
Roman Mashak wrote:
I often come across in open-source software definitions of standard types
with new names, for example:

typedef char SYS_CHAR;
typedef unsigned short SYS_UINT16;
...

Why not to use types specified in C99 or Posix standards?
Maybe the code was written before 1999? Anyhow, C99 is not a widely
adopted standard. If you want to use the C99 stdint.h interface on
many non-C99 compilers, you can use something like my pstdint.h file:

http://www.pobox.com/~qed/pstdint.h

--
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/

Oct 28 '06 #7

"BRG" <br*@nowhere.orgwrote
The original poster claimed that the redefinition of types to obtain
types of guaranteed length or precision was based on the false
assumption that this makes their code more portable.

I pointed out _only_ that their assumption would not _always_ be false.

I am confused by your post because you respond 'No' to this point but
then go on to give details that are inconsistent with this response.
You asserted a negative so "no" signifies concurrence.

Redefining every basic type can make code more portable, if you really know
what you are doing and the code is a self-contained unit.
Generally it is a bad idea that makes code hard to reuse, maybe even hard to
port.

--
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.
Oct 28 '06 #8
BRG
Malcolm wrote:
"BRG" <br*@nowhere.orgwrote
>The original poster claimed that the redefinition of types to obtain
types of guaranteed length or precision was based on the false
assumption that this makes their code more portable.

I pointed out _only_ that their assumption would not _always_ be false.

I am confused by your post because you respond 'No' to this point but
then go on to give details that are inconsistent with this response.
You asserted a negative so "no" signifies concurrence.
Ok, thanks, I did not read it this way.
Redefining every basic type can make code more portable, if you really know
what you are doing and the code is a self-contained unit.
Or, as with many cryptographic algorithms, when the specification of an
algorithm calls for a specific width type. This will often mean that
what has to be typed as an integer on one class of machine will have to
be typed as a long integer on another machine class. On some systems it
can even mean that the type has to be switched when the compiler flags
are switched.
Generally it is a bad idea that makes code hard to reuse, maybe even hard to
port.
I agree that this is not always good and not always bad in portability
terms. Whether there are portability benefits or a detrimental impact on
portability in doing this is not something that can be stated as an
absolute fact because it is dependent on the applications context.

Which is why I contested the original claim.

Brian Gladman
Oct 28 '06 #9
we******@gmail.com wrote:
If you want to use the C99 stdint.h interface on
many non-C99 compilers, you can use something like my pstdint.h file:

http://www.pobox.com/~qed/pstdint.h
While I like the idea of writing a stdint.h for older compilers, I am
puzzled by your comment preceding definitions of int_fastX_t definitions:

* The ANSI C committee pretending to know or specify anything about
* performance is the epitome of misguided arrogance. The mandate of

My understanding is that the definitions allow the implementor to
specify what is fast (efficient) on the target system. That sounds
helpful to me. Where, in your opinion, is the misguided arrogance?

--
Thad
Nov 4 '06 #10

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

Similar topics

1
4266
by: Nel | last post by:
I have a question related to the "security" issues posed by Globals ON. It is good programming technique IMO to initialise variables, even if it's just $foo = 0; $bar = ""; Surely it would...
4
6408
by: Craig Bailey | last post by:
Anyone recommend a good script editor for Mac OS X? Just finished a 4-day PHP class in front of a Windows machine, and liked the editor we used. Don't recall the name, but it gave line numbers as...
1
4077
by: Chris | last post by:
Sorry to post so much code all at once but I'm banging my head against the wall trying to get this to work! Does anyone have any idea where I'm going wrong? Thanks in advance and sorry again...
11
3986
by: James | last post by:
My form and results are on one page. If I use : if ($Company) { $query = "Select Company, Contact From tblworking Where ID = $Company Order By Company ASC"; }
4
18512
by: Alan Walkington | last post by:
Folks: How can I get an /exec'ed/ process to run in the background on an XP box? I have a monitor-like process which I am starting as 'exec("something.exe");' and, of course the exec function...
1
3685
by: John Ryan | last post by:
What PHP code would I use to check if submitted sites to my directory actually exist?? I want to use something that can return the server code to me, ie HTTP 300 OK, or whatever. Can I do this with...
10
4196
by: James | last post by:
What is the best method for creating a Web Page that uses both PHP and HTML ? <HTML> BLA BLA BLA BLA BLA
8
4394
by: Beowulf | last post by:
Hi Guru's, I have a query regarding using PHP to maintain a user profiles list. I want to be able to have a form where users can fill in their profile info (Name, hobbies etc) and attach an...
1
3620
by: joost | last post by:
Hello, I'm kind of new to mySQL but more used to Sybase/PHP What is illegal about this query or can i not use combined query's in mySQL? DELETE FROM manufacturers WHERE manufacturers_id ...
3
3466
by: presspley | last post by:
I have bought the book on advanced dreamweaver and PHP recently. I have installed MySQL and PHP server but am getting an error on the $GET statement show below. It says there is a problem with...
0
7165
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,...
0
7205
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7379
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5462
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4590
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
3093
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
1419
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
291
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.