Pelles C > General discussions

Linking error with _rdtsc() function in Pelles C 10

<< < (2/3) > >>

nex42:
I changed time.h back to original and added intrin.h to my program and it worked well.
It makes sense to keep a standard header file like time.h clean from implementation specific stuff like _rdtsc(), but I agree with Algernon77 that the documentation could be better on this point.
Anyway, thanks to you both.

frankie:
I would like to express differently the point made by Pelle, with the hope that it clarify the issue and the misunderstanding that, in my opinion, has originated here.
The point is that compiler header files have to be considered as read-only objects. They contains definitions that directly interacts with code generated from the compiler, and any modification could possibly interfere with correct working.
If a definition is missed, as first workaround you could add it in your .h or .c files. Then you could eventually investigate if it is defined somewhere. The modification of system headers normally is a no-option.
That was the core of the apparently rude comment from Pelle.
Then he forgot to update help (he was updating a whole compiler system after all), and simply commented out the definition in time.h instead of remove it.
The _rdtsc() intrinsic function was present since version 2.90, and, even being an intrinsic function, still declared in time.h (not standard place, but intrin.h doesn't existed at that time). Now has been moved to where it should have already reside. This generates an incompatibility with existent code, that need to include the new header.

I hope that now reading again the answer it should sound a little different.

MrBcx:
When I read :

Quote from: algernon_77 on October 31, 2020, 02:43:44 pm
    If you remove the comments, your example will compile and run just fine

my next thought was, " why doesn't he ask Pelle why it was blocked out?"

I'll admit it -- I laughed when I read Pelles' reply and I'd bet I'm not the only one
on this forum who appreciates a bit of harmless sarcasm from time to time.

Lessons have been learned .. it's time to get back to work.   8)

algernon_77:
Ok :)

So I'm well past my prom night, and I like Monty Python, but let's not mistake sarcasm for something else :)

The question was about _rdtsc();
In the help file, says that _rdtsc() is declared in time.h, and the intrinsic (from intrin.h) is _rdtscp();
Seeing it commented in time.h, I assumed that, being a one man show, it somehow slipped scrutiny; over the years, I've encountered hiccups in Borland C++, Watcom, Microsoft headers, and they had way more resources with respect to QA.
I assumed wrong and it certainly wasn't my intention to suggest a hackfest on the v10 headers :)

As said, lessons were learned, both ways, hopefully.
This does not change a bit the respect for the work of one man.
I shall refrain from suggesting any such "improvements" in the future :)

Pelle:
Thanks frankie, for clearing up what I was unable to say myself...
I will clean up the help file for the next release, it is confusing ...  :(

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version