[Top][All Lists]

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

Re: [Bug-gsl] Minor improvement to gsl_spmatrix.h suggested

From: Patrick Alken
Subject: Re: [Bug-gsl] Minor improvement to gsl_spmatrix.h suggested
Date: Thu, 4 Jan 2018 15:20:45 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0


  Sounds like a good suggestion to me - I've made the change on the git and hopefully didn't break anything. If you're currently using gsl_spmatrix in your work and can test the update I'd appreciate it.


On 12/22/2017 09:44 AM, Schmitz Manuel (LBC) wrote:
Dear Sirs,

in gsl_spmatrix.h, the struct "gsl_spmatrix" gets defined:

typedef struct
                 void* work;
} gsl_spmatrix;

I am suggesting to replace the member "work" by a union:

typedef struct
                 union {
                                void * work;
                                size_t * work_sze;
                                double * work_dbl;
} gsl_spmatrix;

This has the following benefits:

-          This can avoid (nasty) casts when using the working memory later. 
Unions are considered to be safer than casts.

-          This can avoid compiler warnings about casts when using high warning 

-          It better expresses the intent: "work" shall be used as a buffer for "double" 
or for "size_t".

-          The change does not break the existing interface.

-          The runtime overhead is zero and the compile-time overhead is 

Best regards

i.A. Manuel Schmitz


Liebherr-Werk Biberach GmbH
PO Box 16 63
88396 Biberach an der Riss
Phone: +49 (7351) 414639
Fax: +49 (7351) 412879

Chairman of the supervisory board: Stefan Heissler
Managing directors: Dipl.-Ing. (FH) Marco Guariglia, Dipl.-Ing. Günther 
Hardock, Dr. Thomas Schwaninger, Dipl.-Ing. Dominique Tasch
Registered business address: 88400 Biberach an der Riss, Memminger Straße 120
Court of jurisdiction: Amtsgericht Ulm HRB 640075, USt-Id Nr. DE811120028

This email may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this email in error) please notify 
the sender immediately and destroy this email. Any unauthorized copying, 
disclosure or distribution of the material in this email is strictly forbidden.

reply via email to

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