我在哪里可以了解#ifdef? [英] Where can I learn about #ifdef?

查看:122
本文介绍了我在哪里可以了解#ifdef?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现这经常用于使模块与GHC和拥抱兼容,但谷歌并没有帮助我更多地了解它。

我可以在条件内输入什么?我可以让模块的某些部分以使用什么版本的'base'为条件?



编辑3/2017 :这是一个很棒的资源: https://guide.aelve.com/haskell/cpp-vww0qd72

解决方案

GHC文档有一个与C预处理器相关的部分,其中记录了一些预定义的
pre -processor宏。



Cabal文档有一个与条件编译相关的部分给出了一个与 base 有关的例子。如果你正在编写一个便携包,你应该使用Cabal。


I see this used often to make modules compatible with GHC and Hugs, but google is not helping me learn more about it.

What can I put inside the conditional? Can I make parts of a module conditional on what version of 'base' is in use?

EDIT 3/2017: This is a great resource: https://guide.aelve.com/haskell/cpp-vww0qd72

解决方案

The GHC documentation has a section relating to the C pre-processor that documents some of the predefined pre-processor macros.

The Cabal documentation has a section relating to conditional compilation that gives an example relating to base. If you are writing a portable package, you should be using Cabal, anyway.

这篇关于我在哪里可以了解#ifdef?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆