据我所知,以下两个代码片段都将起到同样的作用.为什么要有finally块?
代码A:
try { /* Some code */ }
catch { /* Exception handling code */ }
finally { /* Cleanup code */ }
Run Code Online (Sandbox Code Playgroud)
代码B:
try { /* Some code */ }
catch { /* Exception handling code */ }
// Cleanup code
Run Code Online (Sandbox Code Playgroud) 我正在使用TextOut()在TCanvas上绘制文本,但我想要更大的字体.
我能做什么?
心理障碍......
我知道这很容易......但今天没有什么事情可言!
任何人都可以帮助我快速搜索字符串并在php中转义所有撇号.谢谢.
是否可以在 OpenGL 固定功能管道中启用每像素照明(以便我可以在低细分曲面上有很好的镜面高光)?
我有一个帖子:
Thread t = new Thread(){
public void run(){
ServerSocketConnection scn = (ServerSocketConnection)
Connector.open("socket://:1234");
// Wait for a connection.
SocketConnection sc = (SocketConnection) scn.acceptAndOpen();
//do other operation
}
};
t.start();
Run Code Online (Sandbox Code Playgroud)
让我们说没有客户端连接到服务器,所以这个线程将被阻止.现在我想杀死上面的线程t?我怎么能杀了它?
我正在寻找某种参考,它显示了流行编程语言的符号频率.我正在尝试为编程设计最佳的键盘布局.
如果没有这样的参考,我不介意创建一个简单的实用程序来解决这个问题.但是,我需要就每种语言分析哪些文件提出建议.
我可以预见的一个问题是我得到了一些Objective-c代码,如果它是一个没有对象的简单程序,那么[和]键的频率远远低于普通的objective-c文件.所以,我会说其中一个指导原则是示例代码应该代表一个普通文件,并使用该语言最常用的功能.
最初我认为我应该使用不同的语言编写相同的代码,但我不确定这是不是一个好主意,因为某些语言的用途不同于其他语言.
我通常在C/C++代码中使用C类型转换.我的问题是,在构建类型中添加"const"关键字是否意味着结果的任何内容?
例如,我可以想出几个场景:
const my_struct *func1()
{
my_struct *my_ptr = new my_struct;
// modify member variables
return (const my_struct *)my_ptr;
// return my_instance;
}
Run Code Online (Sandbox Code Playgroud)
在这一个中,该函数构造一个struct的新实例,并将其转换为常量指针,因此除了删除它之外,调用者将无法进一步修改其内部状态.是"const"转换是必需的,推荐的还是简单的不必要的,因为任何一个return语句都有效.
在这一个中,my_base是基类my_derive.
const my_base *func2(const my_derive *my_ptr)
{
return (const my_base *)my_ptr;
// return (my_base *)my_ptr;
}
Run Code Online (Sandbox Code Playgroud)
因为my_ptr已经是一个const指针,所以会在转换时使用(my_base *)const_cast来删除const和另一个隐式const_cast吗?
是否有任何理由将"const"添加到整数函数参数中,因为更改它永远不会影响函数外的状态?
void func3(const int i)
{
// i = 0; is not allowed, but why, as it is harmless?
}
Run Code Online (Sandbox Code Playgroud)
如何在转换整数时添加"const"?我觉得这应该很像func2().
void func4(short i)
{
const unsigned int …Run Code Online (Sandbox Code Playgroud) 我的IntelliJ idea 9 IDE有问题.我安装了La Clojure插件(http://plugins.intellij.net/plugin/?id=4050)和重启所需的IDE.现在我在启动时遇到以下错误,它不会让我继续工作:
java.lang.AssertionError: Source file C:\Users\foo\.IntelliJIdea90\system\plugins\org.intellij.clojure_8192.zip does not exist for action unzip[C:\Users\foo\.IntelliJIdea90\system\plugins\org.intellij.clojure_8192.zip, C:\Users\foo\.IntelliJIdea90\config\plugins]
at com.intellij.openapi.diagnostic.DefaultLogger.error(DefaultLogger.java:49)
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:48)
at com.intellij.ide.startup.StartupActionScriptManager$UnzipCommand.execute(StartupActionScriptManager.java:189)
at com.intellij.ide.startup.StartupActionScriptManager.executeActionScript(StartupActionScriptManager.java:49)
at com.intellij.ide.ClassloaderUtil.initClassloader(ClassloaderUtil.java:123)
at com.intellij.ide.Bootstrap.main(Bootstrap.java:39)
at com.intellij.ide.Bootstrap.main(Bootstrap.java:35)
at com.intellij.idea.Main.main(Main.java:54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
at com.exe4j.runtime.WinLauncher.main(Unknown Source)
Run Code Online (Sandbox Code Playgroud)
当我在指定的文件夹中找不到zip存档时,我手动将其删除,IDE正确地将其解压缩到config/plugins文件夹,并从system/plugins文件夹中删除了zip文件.然而,它没有解决我的问题,错误仍然存在.有没有办法启动IntelliJ想法禁用该插件?
先谢谢你,Alex