[Gmsh] Question about early post increment

Christophe Geuzaine cgeuzaine at ulg.ac.be
Sat Sep 10 10:27:11 CEST 2016


Jim - Indeed, good catch: our post-increment var++ was actually behaving like ++var. This is now fixed in SVN.


> On 10 Sep 2016, at 00:39, Jim Monte <jim.gmsh at gmail.com> wrote:
> 
> Hi All,
> 
> I was trying to build arrays of point IDs and related things and used the post increment essentially as shown in the simple example below. In this example, the array element pid[0] is unassigned while pid[1] has a value, although I would have expected pid[0] to be the only assigned value. Am I misunderstanding how the increment operator is supposed to work in Gmsh?
> 
> Jim Monte
> 
> /*************** start of example *************************/
> i = 0; /* index to current point ID */
> j = newp; /* get a new point ID */
> pid[i++] = j; /* save point ID */
> Point(j) = {1, 2, 3}; /* assign value to point */
> xyz[] = Point{pid[0]}; /* retrieve coordinates of point */
> Printf("x=%g; y=%g; z=%g", xyz[0], xyz[1], xyz[2]); /* output */
> xyz[] = Point{pid[1]}; /* retrieve coordinates */
> Printf("x=%g; y=%g; z=%g", xyz[0], xyz[1], xyz[2]); /* output */
> /*************** end of example *************************/
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh

-- 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 
http://www.montefiore.ulg.ac.be/~geuzaine

Free software: http://gmsh.info | http://getdp.info | http://onelab.info




More information about the gmsh mailing list