boostorg / boostorg/compute

black_scholes test won't work.

オープン
#276 コメント 13 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug
主要言語
C++
スター
1.7k
フォーク
340
PR マージ指標
30日以内にマージされた PR はありません

説明

Was running the test set and found out that black_scholes doesn't work on my laptop.

``` bash
> ./black_scholes
device: HD Graphics 4000
libc++abi.dylib: terminating with uncaught exception of type boost::exception_detail::clone_impl >: OpenCL Build Warning : Compiler build log:
:1:7: warning: no previous prototype for function 'cnd'
float cnd(float d) [...]
```

Seams like the compiler on OSX need predeclaration to work, with predeclaration this seems to work:

``` bash
diff --git a/example/black_scholes.cpp b/example/black_scholes.cpp
index e78e895..952d28d 100644
--- a/example/black_scholes.cpp
+++ b/example/black_scholes.cpp
@@ -69,6 +69,10 @@ int main()

// source code for black-scholes program
const char source[] = BOOST_COMPUTE_STRINGIZE_SOURCE(
+
+ // some compiler need predeclaration
+ float cnd(float d);
+
// approximation of the cumulative normal distribution function
float cnd(float d)
{
```

Maybe you should not crash on warnings?

Nice work!
##

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。