小编pro*_*eek的帖子

.NET堆栈与Windows堆栈

在Windows内部本书第5版有360页以下评论.

The stack size for the initial thread is taken from the image—there’s no way 
to specify another size.

据我所知,对于Windows操作系统,每个线程都有4K或16K(取决于系统)堆栈,并且大小是固定的.

那么.NET中的堆栈怎么样?

  • 堆栈有多大?
  • 堆栈的大小是固定的还是可变的?
  • 是否像Windows的情况一样为每个线程分配堆栈?

.net stack

7
推荐指数
1
解决办法
1058
查看次数

凌乱的函数指针解释

我碰巧遇到了以下函数指针.

char (*(*x())[])();
Run Code Online (Sandbox Code Playgroud)

它看起来像以下格式的函数指针数组,但我看不出f - >(*x())的含义.如何解释这个凌乱的函数指针?

char (*f[])();
Run Code Online (Sandbox Code Playgroud)

添加

在John Bode的帮助下,我举了一个例子如下.

#include <stdio.h>

char foo()    { return 'a'; }
char bar()    { return 'b'; }
char blurga() { return 'c'; }
char bletch() { return 'd'; }

char (*gfunclist[])() = {foo, bar, blurga, bletch};

char (*(*x())[])()
{
  static char (*funclist[4])() = {foo, bar, blurga, bletch};
  return &funclist;
}

int main() 
{
  printf("%c\n",gfunclist[0]());

  char (*(*fs)[4])();
  fs = x();
  printf("%c\n",(*fs)[1]()); 
}
Run Code Online (Sandbox Code Playgroud)

我可以得到预期的结果.

smcho@prosseek temp2> ./a.out 
a
b

而且,您可以在此处找到更好的实施方案.

c c++ function-pointers

7
推荐指数
3
解决办法
553
查看次数

Silverlight可以在PC/Mac/Linux上运行用C++编写的库吗?

我有一些C++库.有没有办法以跨平台的方式在Silverlight中使用它们(在Linux/Mac/PC上)?如果可能,我不想使用C++/CLI.

我用谷歌搜索了这篇文章,说COM是唯一的方法.但是,我被告知Silverlight4支持PInvoke.

c++ silverlight

7
推荐指数
1
解决办法
743
查看次数

使用Emacs作为组织模式启动

我发现org-mode非常有用,我想在运行emacs时启动org-mode作为默认模式.我怎样才能做到这一点?

emacs org-mode

7
推荐指数
2
解决办法
3420
查看次数

"在'const'错误之前预期的嵌套名称说明符",其中typename为in g ++

我在C++中有这个代码

template<typename T>
class DD
: public enumerables<T>

{
...
private:
    typename const DD<T>& mContainer;
}
Run Code Online (Sandbox Code Playgroud)

它给了我两个错误消息:

  1. 错误:'const'之前的预期嵌套名称说明符
  2. 错误:'&'标记之前的声明符无效

typename const代码有什么问题?它使用MSVC C++编译得很好.

添加

typename DD<T>& const mContainer;并const typename DD<T>& mContainer;给我同样的错误.

c++ g++

7
推荐指数
1
解决办法
1万
查看次数

当我使用命令行构建C#/ .NET时,如何设置配置?

当我的程序试图访问网络驱动器中的DLL时,我收到此错误消息.

Unhandled Exception:
System.IO.FileLoadException: Could not load file or assembly 'file:///Z:\smcho\works\tasks\2011\ni\ng_fpgabackend\myclass.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load maybe dangerous. If this load is not intended to sandbox …
Run Code Online (Sandbox Code Playgroud)

.net c# configuration exception-handling

7
推荐指数
1
解决办法
977
查看次数

为什么XAML的Margin属性有四个组件而不是两个?

当您在WPF的XAML文件中看到Margin属性时,它有四个组件.为什么是这样?前两个组件有意义它们偏离左上方窗口,但当我们有宽度和高度时,第三和第四个组件是什么?

<Grid>
        <Button Content="Button" Height="27" HorizontalAlignment="Left" Margin="29,27,0,0" Name="clickButton" VerticalAlignment="Top" Width="86" Click="clickButton_Click" />
        <TextBox Height="27" HorizontalAlignment="Left" Margin="29,90,0,0" Name="textBoxOut" VerticalAlignment="Top" Width="276" />
</Grid>
Run Code Online (Sandbox Code Playgroud)

wpf xaml

7
推荐指数
3
解决办法
2万
查看次数

C#中的协方差/逆变

我有一本解释逆变/协方差的书如下:

  • 委托可以具有比其方法目标更具体的参数类型.这称为逆变
  • 委托的返回类型可以比其目标方法的返回类型更不具体.这称为协方差

而且,这是一个例子.

using System;

delegate void StringAction(string s);
delegate object ObjectRetriever();

class Test
{
    static void Main()
    {
        StringAction sa = new StringAction(ActionObject);
        sa("hello");

        ObjectRetriever o = new ObjectRetriever(RetrieveString);
        object result = o();
        Console.WriteLine(result);
    }


    static string RetrieveString() {return "hello";}

    static void ActionObject(object o)
    {
        Console.WriteLine(o);
    }
}
Run Code Online (Sandbox Code Playgroud)

我认为为了使用协方差/逆变,需要使用new如示例中所示,但我似乎得到了相同的结果sa = ActionObject和 o = RetrieveString.(我用Mono测试过).

  • 那么,为什么作者new用来解释协方差/逆变?
  • 协方差/逆变思想背后的理论是什么?它只是一个花哨的名字描述object x = Everything inherit from object?这个奇怪的名字来自哪里?它的用途是什么?

c# covariance contravariance

7
推荐指数
1
解决办法
2922
查看次数

eclipse中的"已安装软件"与"功能"对比"插件"

当我点击Installation Details日食时, 在此输入图像描述

我有这个标签 Installed software

在此输入图像描述

和一个标签 Features

在此输入图像描述

和一个标签plug-ins.

在此输入图像描述

eclipse软件,eclipse功能和eclipse插件之间的关系如此窗口所示?

我想Help -> Install New Software ...安装软件,软件由一堆相关的插件组成.这两个选项卡是从Install New Software ...菜单安装的相同内容(软件名称/插件名称)?

Bananeweizen 在他的回答/sf/answers/900415421/中说Eclipse "features" are the smallest installable pieces of Eclipse applications for users (e.g. the Java development toolkit). They consist of multiple plugins, where plugins are the smallest pieces that make sense from the developers point of view (e.g. org.eclipse.jdt.core, org.eclipse.jdt.ui, org.eclipse.jdt.somethingelse).,但对我而言,eclipse功能似乎与eclipse软件几乎相同,而eclipse应用程序是一套eclipse软件(功能)在顶部日食平台.

java eclipse eclipse-plugin

7
推荐指数
1
解决办法
2242
查看次数

"是"运算符在Python中做了什么?

我(可能是错误的)认为is运算符正在进行id()比较.

>>> x = 10
>>> y = 10
>>> id(x)
1815480092
>>> id(y)
1815480092
>>> x is y
True
Run Code Online (Sandbox Code Playgroud)

然而,val is not None看起来它并不那么简单.

>>> id(not None)
2001680
>>> id(None)
2053536
>>> val = 10
>>> id(val)
1815480092
>>> val is not None
True
Run Code Online (Sandbox Code Playgroud)

然后,'是'运营商做了什么?它只是我推测的对象id比较吗?如果是这样,val is not None在Python中被解释为not (val is None)?

python operators

7
推荐指数
1
解决办法
2710
查看次数