void

How to create function that returns nothing

二次信任 提交于 2020-07-16 17:01:33
问题 I want to write a function with pl/pgsql . I'm using PostgresEnterprise Manager v3 and using shell to make a function, but in the shell I must define return type. If I don't define the return type, I'm not able to create a function. How can create a function without return result, i.e a Function that creates a new table? 回答1: Use RETURNS void like below: CREATE FUNCTION stamp_user(id int, comment text) RETURNS void AS $$ #variable_conflict use_variable DECLARE curtime timestamp := now();

Casting an address of subroutine into void pointer

佐手、 提交于 2020-06-27 17:09:04
问题 Is it okay to cast function location with void pointer though function pointers size is not always the same as opaque pointer size? I already did search about opaque pointers , and casting function pointers . I found out function pointers and normal pointers are not the same on some systems. void (*fptr)(void) = (void *) 0x00000009; // is that legal??? I feel I should do this void (*fptr)(void)= void(*)(void) 0x00000009; It did work fine , though I expected some errors or at least warnings I

Casting an address of subroutine into void pointer

删除回忆录丶 提交于 2020-06-27 17:07:07
问题 Is it okay to cast function location with void pointer though function pointers size is not always the same as opaque pointer size? I already did search about opaque pointers , and casting function pointers . I found out function pointers and normal pointers are not the same on some systems. void (*fptr)(void) = (void *) 0x00000009; // is that legal??? I feel I should do this void (*fptr)(void)= void(*)(void) 0x00000009; It did work fine , though I expected some errors or at least warnings I

Python void return type annotation

寵の児 提交于 2020-06-24 07:01:37
问题 In python 3.x, it is common to use return type annotation of a function, such as: def foo() -> str: return "bar" What is the correct annotation for the "void" type? I'm considering 3 options: def foo() -> None: not logical IMO, because None is not a type, def foo() -> type(None): using the best syntax I know for obtaining NoneType , def foo(): omit explicit return type information. Option 2. seems the most logical to me, but I've already seen some instances of 1. 回答1: This is straight from