@@ -238,30 +238,25 @@ macro print(items...)
238
238
end
239
239
end
240
240
241
- @generated function promote_c_argument (arg)
242
- # > When a function with a variable-length argument list is called, the variable
243
- # > arguments are passed using C's old ``default argument promotions.'' These say that
244
- # > types char and short int are automatically promoted to int, and type float is
245
- # > automatically promoted to double. Therefore, varargs functions will never receive
246
- # > arguments of type char, short int, or float.
247
-
248
- if arg == Cchar || arg == Cshort
249
- return :(Cint (arg))
250
- elseif arg == Cfloat
251
- return :(Cdouble (arg))
252
- else
253
- return :(arg)
254
- end
255
- end
241
+ # When a function with a variable-length argument list is called, the variable
242
+ # arguments are passed using C's old ``default argument promotions.'' These say that
243
+ # types char and short int are automatically promoted to int, and type float is
244
+ # automatically promoted to double. Therefore, varargs functions will never receive
245
+ # arguments of type char, short int, or float.
246
+
247
+ promote_c_argument (arg) = arg
248
+ promote_c_argument (arg:: Cfloat ) = Cdouble (arg)
249
+ promote_c_argument (arg:: Cchar ) = Cint (arg)
250
+ promote_c_argument (arg:: Cshort ) = Cint (arg)
256
251
257
252
"""
258
253
@printf(fmt::String, args...)
259
254
260
- This is a unified formatted print statement.
255
+ This is a unified formatted printf statement.
261
256
262
257
# Platform differences
263
258
- `GPU`: This will reorganize the items to print via @cuprintf
264
- - `CPU`: This will call `print( items...)`
259
+ - `CPU`: This will call `sprintf(fmt, items...)`
265
260
"""
266
261
macro printf (fmt:: String , args... )
267
262
fmt_val = Val (Symbol (fmt))
551
546
end
552
547
sfmt = String (fmt)
553
548
quote
554
- # @sprintf($sfmt, $(args...))
555
- @print (@sprintf ($ sfmt, $ (args... )))
556
- # @print("test")
549
+ Printf. @printf ($ sfmt, $ (args... ))
557
550
end
558
551
end
559
552
0 commit comments