[ros-kernel] Differences between ntdll and ntoskrnl Rtl functions

Waldo Alvarez Cañizares wac at lab.matcom.uh.cu
Fri Jun 4 18:17:51 CEST 2004


 
Hi Rick and Gunnar ( see reusing one mail to answer two :))) ) :
 
For this:
 
if (serving_master_one)
{
  // do it this way.
}
else if (serving_master_two)
{
  // do it that way.
}
 
of course some lines does not makes sense at all, that would be to over share :) sources wich I didn't mean.
 
 
Your example isn't really a sharing example, it's a good example of forced
sharing, which nobody proposes here.

Sure. I think you confused things rick. Want a good example ok I'll repeat it again all that code from crtdll and all that from msvcrt identical that someday will change and will cause a lot of problems. Read it!, just copied an pasted there. I talked about that once. Not enough some of that code is duplicated in ntdll too. Well there's also code in ntorkrnl\rtl if I remember ok that is identical to some code in ntdll, there are still about 2 almost identical qsort somewhere (I remember that Hyperion someday removed some because earlier there where about 5!, he knows better). Sometimes data structures are reprogrammed again and again... ad nauseum I have not seen that in ReactOS at least not too much but just in case. Usually in reactos abstract data types are even programmed in separate files although for example bitmaps are not reused too much (I'm not saying that all should be changed beacuse sometimes is simple easier to just mark some bit with a mask and such) I mean excess are bad, you most times have to find a balance, usually thinks are all about finding the best balance or the optimal as you which.
 
Also if you are unhappy with sharing source code then you should be yet more unhappy with COM Objects and the .Net BCL which is like OOP but in binary form, invented by MS as a solution to the problem that has commercial software unable to share source code or having closed dlls for example. beleiveme sharing has always being a good choice because simply to reinvent the wheel again and again won't help us at all. Want to see an example, recently one of my task for machine programming was to make a media player using directshow, guess how much it took me? 1 day, imagine if I would have to program something to interpret AVI, ASF .... , not just that, the decoder for every format I would like it to play, yet more the video and the audio has to be rendered. Guess what, If I would have done such, today I would still be coding, I would get 2 instead of what I would get which I expect to be a 5. On top of that the program would be so little customizable that no one would use it, because using directshow you simply install the codec the splitters, the filters you want and so on and I the programmer do not have to even know the format you want to play. The thing is.. to reuse makes you do the job quickly and fine so later you have time to buy yourself a beer and enjoy your life :))))
 
BTW Guys now that I speak about it, I was looking the other day some code in both crtdll and msvcrt and saw probably the most brain death code I have ever seen. I discovered some bugs that still could be present in current sources and that thing (is in the function that searches for a file, findfirstfilea if I remember ok) sorry I'm in final exams with tests 4-8 hrs(deadly) and I haven't got much time lately but if you can please take a look at it, that thing closes the handle if it finds a *.* if I'm ok. Anyway take a look at it, it really stinks, also the errors reported are not ok, I was looking at the runtime sources that comes with visual studio. BTW is that OK i mean I know that that source code can not be copIed (no no no) but I mean i think Is ok too look at, I mean that's the purpose Right?
 
Might be in some cases when it's

void func(params)
{
        // really a lot lines of code here

        if (serving_master_one)
        {
                // do it this way, contains 2-3 lines of code
        }
        else if (serving_master_two)
        {
                // do it that way, contains 2-3 lines of code
        }

        // even more code located here 
}

Then it is good, why not?

Sure that's what I mean but... what about (taking the words from your example):
 
rparam func1(params)
{
   // really a lot lines of code here
}
 
rparam func2(params)
{
  // even more code located here 
}
 
rparam serve_master_one()
{
           func1(params)
               // do it this way, contains 2-3 lines of code
               func2(params)
}
 
rparam serve_master_two()
{
           func1(params)
           // do it this way, contains 2-3 lines of code
           func2(params)
}
 
most of the times if func1 and func2 are given proper names it won't loose meaning and you can share such functions and is what in fact is common to both.
sometimes func1 and func2 could be a series of meaningfull functions. That's all about structured programming "divide and conquer" right? :)
 
Best Regards
Waldo Alvarez
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 9510 bytes
Desc: not available
Url : http://reactos.com:8080/pipermail/ros-kernel/attachments/20040604/a3b95ee7/attachment.bin


More information about the Ros-kernel mailing list