|
Post by bigbass on Mar 15, 2020 22:59:37 GMT 1
Hello I was debugging some functions and made a macro to get the function prototype info
it works best using clang and c++ but also in gcc with less info
all you have to do is use the macro
'function debugging code for c and better in c++ with clang DEF FN FNINFO$() = printf (" %s\n", __PRETTY_FUNCTION__)
then in whatever function you want to test use paste this inside the function at the top
FNINFO$()
if you use clang the output is
void PRINT_BOOK(Books_type) Book title : C Programming to bacon Book author : anyone Book subject : RECORD Tutorial Book book_id : 1234567
notice void PRINT_BOOK(Books_type)
'PRAGMA COMPILER gcc PRAGMA COMPILER g++ 'PRAGMA COMPILER clang PRAGMA OPTIONS -Wno-write-strings -Wno-pointer-arith
'function debugging code for c and better in c++ with clang DEF FN FNINFO$() = printf (" %s\n", __PRETTY_FUNCTION__)
RECORD Books LOCAL title TYPE STRING LOCAL author TYPE STRING LOCAL subject TYPE STRING LOCAL book_id TYPE int END RECORD
DECLARE Book1 TYPE Books_type
' ------------------ SUB PRINT_BOOK(Books_type book) ' ------------------ FNINFO$() PRINT "Book title : " , book.title FORMAT "%s%s\n" PRINT "Book author : ", book.author FORMAT "%s%s\n" PRINT "Book subject : ", book.subject FORMAT "%s%s\n" PRINT "Book book_id : ", book.book_id FORMAT "%s%d\n" END SUB
Book1.title = "C Programming to bacon " Book1.author = "anyone" Book1.subject ="RECORD Tutorial" Book1.book_id = 1234567 PRINT_BOOK(Book1)
|
|