diff options
author | Karl Berry <karl@freefriends.org> | 2017-03-07 18:10:02 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-03-07 18:10:02 +0000 |
commit | a6dc131e8a2ff8ce660543a262d771380fdf1b4e (patch) | |
tree | 33ab70fd89ae0842cedcfce676aaa6d64a9eb7dc /Build/source/utils/asymptote/doc/asymptote.texi | |
parent | 78cc0e8d7d1977f9cf5c8c9ba3d9de81ed6e03a3 (diff) |
asy 2.40 sources
git-svn-id: svn://tug.org/texlive/trunk@43422 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/doc/asymptote.texi')
-rw-r--r-- | Build/source/utils/asymptote/doc/asymptote.texi | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Build/source/utils/asymptote/doc/asymptote.texi b/Build/source/utils/asymptote/doc/asymptote.texi index 47b67a23736..0c7d92a297a 100644 --- a/Build/source/utils/asymptote/doc/asymptote.texi +++ b/Build/source/utils/asymptote/doc/asymptote.texi @@ -5733,6 +5733,16 @@ real[] a={2.5,-3.5}; int[] b=(int []) a; write(stdout,b); // Outputs 2,-3 @end verbatim +In situations where casting from a string to a type @code{T} fails, +an uninitialized variable is returned; this condition can be detected +with the function @code{bool initialized(T);} +@verbatim +int i=(int) "2.5"; +assert(initialized(i),"Invalid cast."); + +real x=(real) "2.5a"; +assert(initialized(x),"Invalid cast."); +@end verbatim @cindex @code{operator cast} Casting to user-defined types is also possible using @code{operator cast}: @@ -5760,6 +5770,7 @@ straightforward implementation @verbatim real operator cast(int x) {return x*100;} @end verbatim +@noindent is equivalent to an infinite recursion, since the result @code{x*100} needs itself to be cast from an integer to a real. Instead, we want to use the standard conversion of int to real: @@ -6095,7 +6106,7 @@ to the type. This is regardless of what fields the variable actually possesses. @cindex @code{asymptote.sty} @code{Asymptote} comes with a convenient @code{LaTeX} style file -@code{asymptote.sty} (v1.30 or later required) that makes @code{LaTeX} +@code{asymptote.sty} (v1.33 or later required) that makes @code{LaTeX} @code{Asymptote}-aware. Entering @code{Asymptote} code directly into the @code{LaTeX} source file, at the point where it is needed, keeps figures organized and avoids the need to invent new file |