usage of #import in grDevices/src/qdCocoa.h

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

usage of #import in grDevices/src/qdCocoa.h

Michael Chirico
I happened to notice that this header file uses

#import <Cocoa/Cocoa.h>

This is the first time I came across the preprocessor directive #import;
the first thing I found about it is this Q&A suggesting it's not portable
nor standard C:

https://stackoverflow.com/q/39280248/3576984

On the other hand, this exact invocation seems pretty common on GitHub

https://github.com/search?l=C&q=%22%23import+%3CCocoa%2FCocoa.h%3E%22&type=Code

I don't see much in the way of relevant documentation for Cocoa besides
stuff like this page from 2001:

http://cocoadevcentral.com/articles/000031.php

Is this something that should be updated to use #include? Other packages
appear to have done so, e.g. from GitHub:

https://github.com/search?q=%22%23include+cocoa%2Fcocoa.h%22&type=code

Michael Chirico

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: usage of #import in grDevices/src/qdCocoa.h

Gábor Csárdi
On Mon, Oct 19, 2020 at 5:02 AM Michael Chirico
<[hidden email]> wrote:
>
> I happened to notice that this header file uses
>
> #import <Cocoa/Cocoa.h>
>
> This is the first time I came across the preprocessor directive #import;
> the first thing I found about it is this Q&A suggesting it's not portable
> nor standard C:

The Cocoa API is in Objective-C and #import is part of Objective-C.

[...]
> I don't see much in the way of relevant documentation for Cocoa besides
> stuff like this page from 2001:

Apple has the Cocoa docs, e.g. at
https://developer.apple.com/documentation/foundation

Gabor

[...]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel