summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2022-12-02 12:42:07 +0000
committerYves Orton <demerphq@gmail.com>2023-02-28 20:53:51 +0800
commit43442f48654ecf2a2d0ee079c3c24250dbc6db42 (patch)
tree48e3dd02fdc522a534280727a1204a6548bb571e
parentc8ec0d5816566f56e1e1f229a2e9c9a1d46df8f3 (diff)
downloadperl-43442f48654ecf2a2d0ee079c3c24250dbc6db42.tar.gz
pp_sort(): add comments what the op flags mean
-rw-r--r--pp_sort.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/pp_sort.c b/pp_sort.c
index 8cc90a1ade..7753197a76 100644
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -716,6 +716,24 @@ PP(pp_sort)
ENTER;
SAVEVPTR(PL_sortcop);
+
+ /* Important flag meanings:
+ *
+ * OPf_STACKED sort <function_name> args
+ *
+ * (OPf_STACKED
+ * |OPf_SPECIAL) sort { <block> } args
+ *
+ * ---- standard block; e.g. sort { $a <=> $b } args
+ *
+ *
+ * OPpSORT_NUMERIC { $a <=> $b } (as opposed to $a cmp $b)
+ * OPpSORT_INTEGER ditto in scope of 'use integer'
+ * OPpSORT_DESCEND { $b <=> $a }
+ * OPpSORT_REVERSE @a= reverse sort ....;
+ * OPpSORT_INPLACE @a = sort @a;
+ */
+
if (flags & OPf_STACKED) {
if (flags & OPf_SPECIAL) {
OP *nullop = OpSIBLING(cLISTOP->op_first); /* pass pushmark */