Skip to content

Commit

Permalink
circumvent windows snprintf warning; provisions for optional 'void' f…
Browse files Browse the repository at this point in the history
…un return type
  • Loading branch information
gewang committed Nov 14, 2023
1 parent 44557df commit 926bef2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
11 changes: 6 additions & 5 deletions examples/oper/oper_post_inc.ck
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// i++ - doesn't fully work yet (1.2.0.1)
// post increment operator

// starting value
4 => int i;
// assign, then increment i
i++ => int j;

<<<"printing i, then j">>>;
<<<i>>>;
<<<j>>>;
if ( i == 5 && j == 4) <<<"success">>>;
// print (i should be 1 higher than j)
<<< i >>>;
<<< j >>>;
3 changes: 2 additions & 1 deletion src/core/chuck_absyn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,8 @@ a_Func_Def new_func_def( ae_Keyword func_decl, ae_Keyword static_decl,
sizeof( struct a_Func_Def_ ) );
a->func_decl = func_decl;
a->static_decl = static_decl;
a->type_decl = type_decl;
// substitute if NULL | 1.5.1.9 (ge) for constructors
a->type_decl = type_decl ? type_decl : new_type_decl(new_id_list("void",0,0),0,0,0);
a->name = insert_symbol( name );
a->arg_list = arg_list;
a->s_type = ae_func_user;
Expand Down
2 changes: 1 addition & 1 deletion src/core/chuck_instr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4261,7 +4261,7 @@ void Chuck_Instr_Pre_Constructor::execute( Chuck_VM * vm, Chuck_VM_Shred * shred
const char * Chuck_Instr_Pre_Constructor::params() const
{
static char buffer[CK_PRINT_BUF_LENGTH];
snprintf( buffer, CK_PRINT_BUF_LENGTH, "ctor='%s', offset=%lu", pre_ctor ? pre_ctor->name.c_str() : "[null]", stack_offset );
snprintf( buffer, CK_PRINT_BUF_LENGTH, "ctor='%s', offset=%lu", pre_ctor ? pre_ctor->name.c_str() : "[null]", (unsigned long)stack_offset );
return buffer;
}

Expand Down

0 comments on commit 926bef2

Please sign in to comment.