- Posts: 2419
- Thank you received: 2349
Are nested subroutines possible?
- Grotius
- Offline
- Platinum Member
-
Less
More
8 years 4 weeks ago - 8 years 4 weeks ago #118422
by Grotius
Replied by Grotius on topic Are nested subroutines possible?
Hi Eneias,
If you read the C doc's you see goto statement's are not preferred to use.
One google of this : The goto statement is rarely used because it makes program confusing, less readable and complex. Also, when this is used, the control of the program won’t be easy to trace, hence it makes testing and debugging difficult.
beginnersbook.com/2014/01/c-goto-statement/
Better is to use a procedure that read's continue.
I have a example code for you :
The program start's with a template, the variable numbers are for fun :
github.com/michelwijnja/Linuxcnc_inox_do...oxdoors_template.ngc
The the program has no goto statement's :
github.com/michelwijnja/Linuxcnc_inox_do...files/subroutine.ngc
In my C code i use only a Goto if there is no other option :
github.com/michelwijnja/Linuxcnc_grotius...components/THC2.comp
Line 238 for restart attempts.
I hope this info is usefull for you !
If you read the C doc's you see goto statement's are not preferred to use.
One google of this : The goto statement is rarely used because it makes program confusing, less readable and complex. Also, when this is used, the control of the program won’t be easy to trace, hence it makes testing and debugging difficult.
beginnersbook.com/2014/01/c-goto-statement/
Better is to use a procedure that read's continue.
I have a example code for you :
The program start's with a template, the variable numbers are for fun :
github.com/michelwijnja/Linuxcnc_inox_do...oxdoors_template.ngc
The the program has no goto statement's :
github.com/michelwijnja/Linuxcnc_inox_do...files/subroutine.ngc
In my C code i use only a Goto if there is no other option :
github.com/michelwijnja/Linuxcnc_grotius...components/THC2.comp
Line 238 for restart attempts.
I hope this info is usefull for you !
Last edit: 8 years 4 weeks ago by Grotius.
- eneias_eringer
- Offline
- Junior Member
-
Less
More
- Posts: 24
- Thank you received: 4
8 years 3 weeks ago #118553
by eneias_eringer
Replied by eneias_eringer on topic Are nested subroutines possible?
thankyou !!!
I agree that is better to not use goto !!!
but my point is , all cnc controllers have a normal goto , so when you have to convert a code , is very hard !!!
In example , try to convert a Renishaw code , is easyer to write a new just becouse we dont have a goto !!
I agree that is better to not use goto !!!
but my point is , all cnc controllers have a normal goto , so when you have to convert a code , is very hard !!!
In example , try to convert a Renishaw code , is easyer to write a new just becouse we dont have a goto !!
Time to create page: 0.506 seconds