Evan,

I believe Ibrar used the GetLastError() function as an example of a
more general comment.

The point is to encapsulate the dependence on Windows in every
instance so that the program can be ported to other systems.

It would be useful to improve the functions where possible when they
are encapsulated, but I do not think the details of GetLastError() are
really the point of the message.

If I misunderstood Ibrar, I would like to know what you plans are to
enable porting away from Windows.

Ken


On Tue, 21 Oct 2008 08:29:16 -0700, you wrote:

>
>Ibrar,
>
>What is the return value of that function?  It has the "int" but its
>meaning ends up being platform-specific.  I'd instead argue that there
>are two cases where GetLastError shows up:
>1) Places where the code is checking for specific errors, in which
>case we'll need platform-specific tests as error codes vary; and
>2) Places where the code is checking for errors in general, in which
>case it may make sense to have a generic boolean-returning function
>(like "DidErrorOccur"), but even then I'd prefer the code to properly
>handle the error (and convert it to a more helpful string error
>message).
>
>On Tue, Oct 21, 2008 at 2:44 AM, Ibrar Ahmed <[EMAIL PROTECTED]> wrote:
>>
>> Hi All,
>>
>> While porting some module on Linux I feel that there are lot of
>> Windows specific call exists. IMHO we should at least wrap these
>> function with OS macros and bound further development to use that
>> functions. This will really reduce the porting effort  on different
>> OS, because whenever you start porting a module you should wrap that
>> function first and then do actual function. This looks like a
>> mechanical work and totally waste of time.
>>
>> Here is the example what I want to state here.
>>
>> We are using GetLastError() function  almost 100+ times. So it Should
>> looks like this
>>
>> Calling
>> ====
>> platform::GetLastError();
>>
>>
>> Function
>> =====
>> namespace platform (or any other name)
>> {
>>
>>  int GetLastError()
>>  {
>> #if defined(OS_WIN)
>>    return GetLastError();
>> #elif defined(OS_POSIX)
>>    return errno;
>> #endif
>> }
>>
>> }
>>
>>
>> Comments?
>>
>> --
>>   Ibrar Ahmed
>>   EnterpriseDB   http://www.enterprisedb.com
>>
>> >
>>
>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Chromium-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/chromium-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to