gpt4 book ai didi

c - 如果 GTK 无法创建新对象会怎样?

转载 作者:太空宇宙 更新时间:2023-11-04 02:51:23 25 4
gpt4 key购买 nike

我正在为一个小程序使用 GTK,我想知道如果无法创建小部件会发生什么。我还没有找到与此相关的任何文档。

假设我正在分配一个菜单

menu = gtk_menu_new();

分配不上怎么办?系统可能没有足够的内存,所以我相信它会失败。如果发生错误,我该如何处理?

最佳答案

也许:

If any call to allocate memory fails, the application is terminated. This also means that there is no need to check if the call succeeded.

来自:https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html

关于c - 如果 GTK 无法创建新对象会怎样?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21804749/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com