Skip to content

Commit 544e23f

Browse files
committed
perlapi: Combine croak() and die() entries
This makes it easier for the reader to decide which one to use.
1 parent c14d142 commit 544e23f

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

util.c

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,21 +1779,6 @@ Perl_die_sv(pTHX_ SV *baseex)
17791779
}
17801780
MSVC_DIAG_RESTORE
17811781

1782-
/*
1783-
=for apidoc die
1784-
=for apidoc_item die_nocontext
1785-
1786-
These behave the same as L</croak>, except for the return type.
1787-
They should be used only where the C<OP *> return type is required.
1788-
They never actually return.
1789-
1790-
The reasons for the existence of C<die_nocontext> are no longer applicable.
1791-
die() can now be used in all circumstances. C<Perl_die_nocontext> might be
1792-
useful when compiling with C<PERL_NO_SHORT_NAMES>.
1793-
1794-
=cut
1795-
*/
1796-
17971782
#if defined(MULTIPLICITY)
17981783

17991784
/* silence __declspec(noreturn) warnings */
@@ -1891,8 +1876,10 @@ Perl_vcroak(pTHX_ const char* pat, va_list *args)
18911876
}
18921877

18931878
/*
1894-
=for apidoc croak
1879+
=for apidoc croak
1880+
=for apidoc_item die
18951881
=for apidoc_item croak_nocontext
1882+
=for apidoc_item die_nocontext
18961883
18971884
These are XS interfaces to Perl's C<die> function.
18981885
@@ -1912,9 +1899,15 @@ error message from arguments. If you want to throw a non-string object,
19121899
or build an error message in an SV yourself, it is preferable to use
19131900
the C<L</croak_sv>> function, which does not involve clobbering C<ERRSV>.
19141901
1915-
The reasons for the existence of C<croak_nocontext> are no longer applicable.
1916-
croak() can now be used in all circumstances. C<Perl_croak_nocontext> might be
1917-
useful when compiling with C<PERL_NO_SHORT_NAMES>.
1902+
The difference between the C<croak> forms and the C<die> forms is only the
1903+
return type of the functions. The C<croak> forms return C<void>; the C<die>
1904+
ones are listed as returning (confusingly) an S<C<OP *>>, even though they
1905+
never actually return. The C<die> forms should only be used when that return
1906+
type is required.
1907+
1908+
When called from outside the perl core, plain C<croak> and C<die> have always
1909+
been the same as C<croak_nocontext> and C<die_no_context>, respectively. That
1910+
is now true even when called from within core.
19181911
19191912
=cut
19201913
*/

0 commit comments

Comments
 (0)