小编And*_*een的帖子

在x86程序集中向堆栈添加变量

我想知道,如何在ASM程序中设置局部变量?

谢谢!!

x86 assembly local-variables x86-16

0
推荐指数
1
解决办法
6819
查看次数

创建一个实现其自身方法的接口

我想创建一个在Java中实现它自己的一些方法的接口(但是语言不允许这样做,如下所示):

//Java-style pseudo-code
public interface Square {
    //Implement a method in the interface itself
    public int getSize(){//this can't be done in Java; can it be done in C++?
        //inherited by every class that implements getWidth()
        //and getHeight()       
        return getWidth()*getHeight();
    }
    public int getHeight();
    public int getWidth();
}

//again, this is Java-style psuedocode
public class Square1 implements Square{

    //getSize should return this.getWidth()*this.getHeight(), as implemented below

    public int getHeight(){
        //method body goes here
    }

    public int getWidth{
        //method body goes here
    } …
Run Code Online (Sandbox Code Playgroud)

java interface text-files

0
推荐指数
2
解决办法
549
查看次数

Java - 将JTextArea中的字符串转换为图像

我有一个字符串显示在我的程序中,但我想知道如何将字符串的输出转换为与原始字符串相同的图像.不知道是否可以这样做.

我希望输出完全是JTextArea.这是可能的,如果可以的话,我应该研究什么?

java string image

0
推荐指数
1
解决办法
1510
查看次数

是否可以在C++中将函数作为参数传递?

有没有办法在C++ 中将函数作为参数传递,比如函数在C中作为参数传递的方式?我知道可以使用函数指针将函数作为参数传递给C,我想知道在C++中是否可以实现相同的功能.

c++ parameters function

0
推荐指数
1
解决办法
406
查看次数

以x86汇编语言获取EAX寄存器的第一位

在x86汇编语言中,是否可以获得寄存器的第一位?我想获得eax寄存器的第一位并将其移入ebx,但我不知道该如何做到这一点.

.stack 2048

.data

ExitProcess proto, exitcode:dword 

.code
start:
mov eax, 3;
;now I want to move the first bit of eax into ebx. How can I obtain the first bit from eax?
invoke  ExitProcess, 0
end start
Run Code Online (Sandbox Code Playgroud)

x86 assembly

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

MASM 中的 if-else 宏

在 MASM 中,是否可以创建 if...ekse 宏(类似于高级编程语言中的宏)?我还没有为 MASM 找到任何类型的 if-else 语句宏,但我认为用于此目的的宏将非常有用。

如果我能找到一个宏来使在 masm 中编写一系列复杂的 if 语句变得更容易,那将会很有用,如下所示:

;jump to each case here
    checkCase1:
    cmp theVariable, 5;
    jne case1; 

    checkCase2:
    cmp theVariable, var2;
    jne case2;

    jmp defaultCase; do this if no other statement is true
;each of the cases are handled here

    case1:
    ;handle case 1
    jmp checkCase2; //check whether case 2 is true

    case2:
    handle case 2
    jmp endOfStatement;
    defaultCase:
        ;this is the default case
endOfStatement:
;this is the end of the statement
Run Code Online (Sandbox Code Playgroud)

x86 masm

0
推荐指数
1
解决办法
8547
查看次数

在页面的URL中嵌入JavaScript对象

我正在尝试将JavaScript对象存储在网页的URL中(作为JSON字符串),但URL包含一些不适用于HTML链接的字符.

在此页面上,从页面的URL加载JavaScript对象:

http://jsfiddle.net/tsUpC/1/show/#["Hello","World!"]

在这个页面上,我正在尝试创建一个指向上面显示的同一页面的链接,但URL包含超链接中不允许的字符:

http://jsfiddle.net/M6dRb/

<a href = "http://jsfiddle.net/tsUpC/1/show/#["Hello","World!"]">This link doesn't work because the URL contains characters that are not allowed in HTML links.</a>
Run Code Online (Sandbox Code Playgroud)

是否可以在不使用与超链接不兼容的字符的情况下将JavaScript对象嵌入到URL中?

html javascript

0
推荐指数
1
解决办法
784
查看次数

设置Python数组的索引

我正在尝试在Python中设置数组的索引,但它没有按预期运行:

theThing = []
theThing[0] = 0
'''Set theThing[0] to 0'''
Run Code Online (Sandbox Code Playgroud)

这会产生以下错误:

Traceback (most recent call last):
  File "prog.py", line 2, in <module>
    theThing[0] = 0;
IndexError: list assignment index out of range
Run Code Online (Sandbox Code Playgroud)

在Python中设置数组索引的正确语法是什么?

python

0
推荐指数
1
解决办法
464
查看次数

如何在x86汇编语言中创建嵌套循环

是否可以在x86汇编语言中创建嵌套循环?

我想将这个psedocode转换为正确的x86汇编代码(使用MASM语法),但我不知道如何在这里初始化每个循环计数器.甚至可以在x86程序集中声明局部变量(与大多数其他编程语言一样)?

for (var i = 0; i < 10; i++){
    for(var j = 0; j < 10; j++){
        for(var k = 0; k < 10; k++){
            mov eax, i + j + k;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

x86 assembly masm

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

是否可以将C数组放入其中?

在许多编程语言(包括JavaScript,JavaRuby)中,可以在其自身内部放置一个数组.在这里,我试图在其第三个索引处放置一个C整数数组,但我不确定C编程语言是否支持它:

#include <stdio.h>

int main(void) {
    int arr[] = {1, 1, 2};
    arr[2] = arr; //now I'm trying to put arr into itself.
    printf("%i", arr[2]); //this prints a negative number each time I run the program
    printf("%i", arr[2][0]); //prog.c:7:24: error: subscripted value is neither array nor pointer nor vector

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

是否可以将C数组放入其中,或者根本不可能?

c arrays

0
推荐指数
1
解决办法
205
查看次数