Description:
Discussion about C.
|
|
|
Breakthrough
|
| |
Hi
In a recent discussion ("Open letter to Ian Collins") we found out that the main problem in the C containers library was the time taken by the Sort function.
The reasons for that is that it was a general sort function calling a general comparison function that uses memcmp...
The first step to improve performance was to write data type specific... more »
|
|
Quasi 0
|
| |
Hi friends:
Machine epsilon is the maximum relative error of the chosen rounding
procedure
...
int main(void)
{
double a = 0.1;
double b = 0.1;
a += 1.0;
a -= 1.0;
printf("a == b = %s\n", a == b ? "equals" : "unequals");
printf("a == b = %s\n", fabs(a - b) < DBL_EPSILON ? "equals" :... more »
|
|
Array sizes and const
|
| |
I am using Mingw 3.4.5 on a 'Doze box, but it pretty much
follows any Gnu compiler I've run into.
Why is this:
---------------------------
...const int size = SIZE;
char array[SIZE];
---------------------------
legal, yet
---------------------------
...const int size = SIZE;
char array[size];... more »
|
|
WHAT DO MUSLIMS THINK ABOUT JESUS ?????????
|
| |
WHAT DO MUSLIMS THINK ABOUT JESUS?
I know that my article is not related to this group ,but it might be
useful.
PLEASE read it
What do Muslims think about Jesus?
Muslims respect and revere Jesus (SAW) and await his Second Coming.
They consider him one of the greatest of God’s messengers to mankind.... more »
|
|
Q: Local variables initialization shortcut.
|
| |
Hi all,
The function f() has some local (double)
which should all be initialized to zero :
a = b = c = ... = y = z = 0.0;
Can I use a shortcut like this :
memset( &a, 0, number_of_variables * sizeof(double) );
If yes, can I do this :
memset( &a, 0, (&z - &a + sizeof(double)) );... more »
|
|
Updates to the containers library
|
| |
I have been reworking the heap allocation module. This module should be
the base of many containers since it is specialized in allocating a lot
of objects all of the same size.
I have discarded the bitmap I maintained to track the free list for a
slightly more sophisticated approach.
I allocate a table of pointers to pages of CHUNK_SIZE objects. Since one... more »
|
|
Returning a structure without any temporary variable
|
| |
Hi folks,
Is the following code standard ? (which one ?)
typedef struct my_t {
double d;
unsigned long long l;
...
void my_t getOne() {
return (my_t) { 1.0 };
...
My feeling is that the code might be correct in C99, but not in C89.
|
|
Decomposing a FLOAT
|
| |
Hello
If I have a FLOAT variable how to retrieve its exponent and mantissa in the most portable way.
Cheers Raj
|
|
Aliasing in C99
|
| |
I am trying to figure out how to get aliasing to work correctly according to the C99 rules. For example, converting between a float and its binary representation.
float negPCast(float x) {
uint32_t u = *((uint32_t *) &x);
u ^= 0x80000000u;
return *((float *) &u);
...
In the absence of type-based aliasing, this will negate a float using... more »
|
|
|