# C's variables and pointers holding a C enum (owner, 2026-09-28: b). A C variable holds C's# plain number, since reading a variable never fails; convert it with `to.Mode[…]`, and back# with `to.int32[Mode.vi]`, which never fails. `ptr.read` of a C enum is a call, so it takes# `otherwise` and fails `out_of_range` for a number no case has (7 here).layout.CenumMode{emacs=0,vi=1}extern.Cfnmalloc['bytes':uint64]->ptr.mut[Mode];extern.Cmut'edit_mode':int32;fnmode_at['p':ptr[Mode]]->int32{no_checklet'm':=ptr.read['p']otherwiseMode.emacs;match'm'{emacs{return10;}vi{return11;}}}MAIN{no_checkchange'edit_mode'=to.int32[Mode.vi];no_checklet'raw':='edit_mode';let'current':=to.Mode['raw']otherwiseMode.emacs;no_checklet'mem':=malloc[8];no_checkptr.write['mem',value1];no_checkptr.write[ptr.at['mem',by1],value7];no_checklet'a':=mode_at['mem'];no_checklet'b':=mode_at[ptr.at['mem',by1]];std::print.useful[to.int32['current']," ",'a'," ",'b',newln];}