586,062 active members*
4,410 visitors online*
Register for free
Login
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2008
    Posts
    67

    Bug in sample programs

    Hi,

    I would like to point out that there is a common bug in a number of the sample C programs that I have scanned through, for example in the program HomeBrushlessSnap4.c, but in some others too.

    In these programs, the variable "k" is defined as float, and then iterated using k++ and ++k. This doesn't work, iterating floats is not part of the C programming language. k would need to be defined as an integer and then cast using (float) as needed.

    The programs as provided would not work. Just giving a heads-up ...

    Regards,
    Frank

  2. #2
    Join Date
    May 2006
    Posts
    4045
    Hi Frank,

    Thanks for checking things over but that is actually not a bug. Ansi C allows the ++ operator to work with any scalar type which includes floating point. We do this somtimes intentionally because on KFLOP's DSP adding one to a floating point number can be performed simpler and faster than incrementing an integer and then converting it to floating point.

    Regards,
    TK
    http://dynomotion.com

  3. #3
    Join Date
    Mar 2008
    Posts
    67
    Hi Tom,

    I stand corrected.

    Regards,
    Frank

  4. #4
    Join Date
    May 2006
    Posts
    4045
    Please keep looking Frank!
    TK
    http://dynomotion.com

Similar Threads

  1. Citizen E32IV: Looking for sample Programs
    By DaveGus in forum CNC Swiss Screw Machines
    Replies: 1
    Last Post: 07-27-2011, 03:14 PM
  2. Need Sample Dynapath 20 Programs
    By BlueChip in forum Dynapath
    Replies: 5
    Last Post: 01-20-2011, 04:49 PM
  3. Fanuc T14IA Robodrill Need Sample Programs
    By gorillam in forum CNC (Mill / Lathe) Control Software (NC)
    Replies: 0
    Last Post: 09-06-2010, 09:29 PM
  4. Citizen E32J Fanuc 6T sample programs
    By championfine in forum CNC Swiss Screw Machines
    Replies: 3
    Last Post: 01-14-2010, 05:07 PM
  5. Sample Lathe Programs For Fanuc 10T
    By metx in forum G-Code Programing
    Replies: 6
    Last Post: 01-04-2008, 03:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •