[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-task-tracker] [task #15469] Eliminate or reduce use of "mutable"

From: Rik
Subject: [Octave-task-tracker] [task #15469] Eliminate or reduce use of "mutable" keyword in C++
Date: Mon, 18 Nov 2019 18:31:53 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko


                 Summary: Eliminate or reduce use of "mutable" keyword in C++
                 Project: GNU Octave
            Submitted by: rik5
            Submitted on: Mon 18 Nov 2019 03:31:51 PM PST
         Should Start On: Mon 18 Nov 2019 12:00:00 AM PST
   Should be Finished on: Mon 18 Nov 2019 12:00:00 AM PST
                Category: Wish
                Priority: 5 - Normal
                  Status: In Progress
                 Privacy: Public
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
           Fixed Release: None
         Planned Release: None



The "mutable" keyword is often used as a hack, when really the code should be
re-thought out to eliminate the need to change a member of a const object.

Instances of mutable found in libinterp:

corefcn/graphics.in.h:3185:      mutable string_property __gl_extensions__ hr
, ""
corefcn/graphics.in.h:3186:      mutable string_property __gl_renderer__ hr ,
corefcn/graphics.in.h:3187:      mutable string_property __gl_vendor__ hr ,
corefcn/graphics.in.h:3188:      mutable string_property __gl_version__ hr ,
corefcn/load-path.h:515:    mutable package_map_type package_map;
corefcn/load-path.h:517:    mutable package_info top_level_package;
corefcn/load-path.h:519:    mutable dir_info_list_type dir_info_list;
corefcn/load-path.h:521:    mutable std::set<std::string> init_dirs;
corefcn/mxarray.in.h:105:#define DO_MUTABLE_METHOD(RET_T, METHOD_CALL)   \
corefcn/mxarray.in.h:116:#define DO_VOID_MUTABLE_METHOD(METHOD_CALL)     \
corefcn/mxarray.in.h:431:  void set_m (mwSize m) { DO_VOID_MUTABLE_METHOD
(set_m (m)); }
corefcn/mxarray.in.h:433:  void set_n (mwSize n) { DO_VOID_MUTABLE_METHOD
(set_n (n)); }
corefcn/mxarray.in.h:436:  { DO_MUTABLE_METHOD (int, set_dimensions (dims_arg,
ndims_arg)); }
corefcn/mxarray.in.h:460:  { DO_VOID_MUTABLE_METHOD (set_class_name
(name_arg)); }
corefcn/mxarray.in.h:463:  { DO_MUTABLE_METHOD (mxArray *, get_cell (idx)); }
corefcn/mxarray.in.h:466:  { DO_VOID_MUTABLE_METHOD (set_cell (idx, val)); }
corefcn/mxarray.in.h:470:  void * get_data (void) const { DO_MUTABLE_METHOD
(void *, get_data ()); }
corefcn/mxarray.in.h:473:  { DO_MUTABLE_METHOD (void *, get_imag_data ()); }
corefcn/mxarray.in.h:475:  void set_data (void *pr) { DO_VOID_MUTABLE_METHOD
(set_data (pr)); }
corefcn/mxarray.in.h:477:  void set_imag_data (void *pi) {
DO_VOID_MUTABLE_METHOD (set_imag_data (pi)); }
corefcn/mxarray.in.h:479:  mwIndex * get_ir (void) const { DO_MUTABLE_METHOD
(mwIndex *, get_ir ()); }
corefcn/mxarray.in.h:481:  mwIndex * get_jc (void) const { DO_MUTABLE_METHOD
(mwIndex *, get_jc ()); }
corefcn/mxarray.in.h:485:  void set_ir (mwIndex *ir) { DO_VOID_MUTABLE_METHOD
(set_ir (ir)); }
corefcn/mxarray.in.h:487:  void set_jc (mwIndex *jc) { DO_VOID_MUTABLE_METHOD
(set_jc (jc)); }
corefcn/mxarray.in.h:489:  void set_nzmax (mwSize nzmax) {
DO_VOID_MUTABLE_METHOD (set_nzmax (nzmax)); }
corefcn/mxarray.in.h:491:  int add_field (const char *key) { DO_MUTABLE_METHOD
(int, add_field (key)); }
corefcn/mxarray.in.h:494:  { DO_VOID_MUTABLE_METHOD (remove_field (key_num));
corefcn/mxarray.in.h:497:  { DO_MUTABLE_METHOD (mxArray *, get_field_by_number
(index, key_num)); }
corefcn/mxarray.in.h:500:  { DO_VOID_MUTABLE_METHOD (set_field_by_number
(index, key_num, val)); }
corefcn/mxarray.in.h:505:  { DO_MUTABLE_METHOD (const char*,
get_field_name_by_number (key_num)); }
corefcn/mxarray.in.h:508:  { DO_MUTABLE_METHOD (int, get_field_number (key));
corefcn/mxarray.in.h:552:  mutable mxArray_base *rep;
corefcn/mxarray.in.h:562:#undef DO_MUTABLE_METHOD
corefcn/mxarray.in.h:563:#undef DO_VOID_MUTABLE_METHOD
corefcn/oct-stream.h:467:    mutable ostrl_map::const_iterator
octave-value/ov-base-diag.h:247:  mutable octave_value dense_cache;
octave-value/ov-base-mat.h:210:  mutable MatrixType *typ;
octave-value/ov-base-mat.h:211:  mutable idx_vector *idx_cache;
octave-value/ov-base-sparse.h:196:  mutable MatrixType typ;
octave-value/ov-cell.h:184:  mutable std::unique_ptr<Array<std::string>>
octave-value/ov-dld-fcn.h:102:  mutable octave::sys::time t_checked;
octave-value/ov-lazy-idx.h:270:  mutable octave_value value;
octave-value/ov-mex-fcn.h:117:  mutable octave::sys::time m_time_checked;
octave-value/ov-perm.h:261:  mutable octave_value dense_cache;
octave-value/ov-range.h:332:  mutable idx_vector *idx_cache;
parse-tree/jit-typeinfo.h:434:    mutable generated_map m_generated;
corefcn/ft-text-renderer.cc:557:      mutable FT_Face face;
corefcn/mex.cc:652:  mutable bool mutate_flag;
corefcn/mex.cc:658:  mutable mxClassID id;
corefcn/mex.cc:659:  mutable char *class_name;
corefcn/mex.cc:660:  mutable mwSize ndims;
corefcn/mex.cc:661:  mutable mwSize *dims;
corefcn/mex.cc:2409:  mutable char *fname;

Instances of mutable found in liboctave:

array/Range.h:153:  mutable Matrix cache;
array/idx-vector.h:424:    mutable octave_idx_type lsti;
array/idx-vector.h:425:    mutable octave_idx_type lste;
system/oct-env.h:139:      mutable std::string current_directory;
system/oct-env.h:142:      mutable std::string prog_name;
system/oct-env.h:144:      mutable std::string prog_invocation_name;
system/oct-env.h:146:      mutable std::string user_name;
system/oct-env.h:148:      mutable std::string host_name;


File Attachments:

Date: Mon 18 Nov 2019 03:31:51 PM PST  Name: libinterp.mutable.list  Size:
4KiB   By: rik5

Date: Mon 18 Nov 2019 03:31:51 PM PST  Name: libinterp.mutable.list  Size:
4KiB   By: rik5



Reply to this item at:


  Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]