English 中文(简体)
是否有办法达到这种职能的规模?
原标题:Is there any way to get the size of a c function?
  • 时间:2011-11-03 09:13:29
  •  标签:
  • c

我想知道,在运行时间,能否让笼罩在记忆中。

我曾使用过这一法典,但没有发挥作用:

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>

int main(void)
{
    int t[10];
    char c;
    offsetof(t, p);
    p: 
    return 0;
}
最佳回答

答案一般没有。 你们可以 t。 一个原因是,职能不一定是连续的记忆。 因此,他们没有“人口”。 有时,汇编者(即国际商会)将跳出该功能,跳跃到双亲的边远部分, back回。

见上文一个相关问题:

how在双亲代码中找到功能界限

问题回答

您将数据与代码混为一谈,可变的<代码>t与功能main无关。 <代码>t储存在栏目上,main载于代码栏。

至于职能的规模,没有达到规模的标准方法。 如果你愿意撰写一个拆组和静态编码分析,你可能会对规模有一个粗略的想法,但即使这并非是最后的<代码>>>>>>>>指示可能不是该功能的最后指示,就说你是在休息期间返回。

您可以分析汇编/链接输出数据(PDB、地图文档等)。

但是,为什么你们需要知道?

你可以仔细研究。 多数环境都有解体者,汇编者自己往往能够从你的来源中产生。

我看到了这一点,但我确实可以想象,为什么你们需要。 记住的是,如果你分出两点,就会产生一个穿透器,如果在第一点添加,就会产生第二点。 这为职能点人工作! 因此:

#include <stdio.h>

int main (void) {
    printf("main is %u bytes long
", (unsigned) (metamain - main));
    return 0;
}

void metamain (void) {
}




相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签