c# - 是否有任何 "hacks"能够从 main() 返回一个 long?

标签 c# algorithm

根据 MSDN,main() 的返回值只能是 voidint:https://msdn.microsoft.com/en-us/library/0fwzzxz2.aspx .

根据我正在尝试的编程挑战,

This document specifies the intended operation of the csLogic.exe program

csLogic [equation] [parameter1] [parameter2] [parameter3] ...

example usage: csLogic.exe ~1^(2~&3) 0x3FFE 0x2FCE 0xFCC1

Returns the value: 4926 (0x133E)

[...]

Parameters are up to 64 bit values

[...]

有没有办法让我的 main() 返回 64 位值?或者有解决办法吗?

最佳答案

不,但这不是 C# 限制而是 WinAPI limitation , 一个进程的退出代码只能是一个 32 位数字,无论它是用什么语言编写的。

作为“绕过它的方法”,我们需要您的要求的更多详细信息,您的挑战是否需要您使用程序的返回码?您可以将结果输出到 Console.Write( 或输出文件吗?

关于c# - 是否有任何 "hacks"能够从 main() 返回一个 long?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33273542/

相关文章:

C# IEEE754 舍入

algorithm - 用于小集合集合成员查询的快速空间高效数据结构

c# - 如何将List<List<Int32>>的初始化简化为IEnumerable<IEnumerable<Int32>>?

c# - 为什么调用 await 会过早地完成父任务?

c# - 使命名元组的名称出现在序列化的 JSON 响应中

javascript - Google 的 SNAPPY 算法在 javascript 中的实现(客户端)

java - 加到 n 的 1 + 2 的所有组合

algorithm - 在指定位置最佳切割木棒

algorithm - 纸男孩的聚类算法

c# - 跟踪无效的回发或回调参数