📄 mf_callersversion.hlp
字号:
{smcl}
{* 11mar2005}{...}
{cmd:help mata callersversion()}
{hline}
{* index version control}{...}
{* index callersversion()}{...}
{title:Title}
{p 4 4 2}
{bf:[M-5] callersversion() -- Obtain version number of caller}
{title:Syntax}
{p 8 12 2}
{it:real scalar}
{cmd:callersversion()}
{title:Description}
{p 4 4 2}
{cmd:callersversion()} returns the version set by the caller
(see {bf:{help m2_version:[M-2] version}}),
or if the caller did not set the version, it returns the version of Stata
under which the caller was compiled.
{title:Remarks}
{p 4 4 2}
{cmd:callersversion()} is how {bf:{help m2_version:[M-2] version}}
is made to work.
For instance, say you have written function
{it:real matrix} {cmd:useful(}{it:real matrix A}{cmd:,} {it:real scalar k}{cmd:)}
{p 4 4 2}
and assume that {cmd:useful()} aborts with error if {it:A} is void.
You wrote {cmd:useful()} in the days of Stata 9. For Stata 10, you want
to change {cmd:useful()} so that it returns J(0,0,.) if {it:A} is
void, but you want to maintain the current behavior for old Stata 9
callers and programs. You do that as follows:
{cmd}real matrix useful(real matrix A, real scalar k)
{
...
if (callersversion()>=10) {
if (rows(A)==0 | cols(A)==0) return(J(0,0,.))
}
...
}{txt}
{title:Conformability}
{cmd:callersversion()}:
{it:result}: 1 {it:x} 1
{title:Diagnostics}
{p 4 4 2}
None.
{title:Source code}
{p 4 4 2}
Function is built-in.
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-5] callersversion()}
{p 4 13 2}
Online: help for
{bf:{help m2_version:[M-2] version}};
{bf:{help m4_programming:[M-4] programming}}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -