小编Dal*_*und的帖子

写数据到寄存器

我有某个寄存器的存储器地址(地址LCDCW1是C000).

c代码:

#define LCDCW1 0xC000

*LCDCW1=0x31;
Run Code Online (Sandbox Code Playgroud)

我只想将数据写入该寄存器.代码有问题,如何纠正呢?

谢谢!

c hardware embedded pointers

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

CVS&符号模块等效于git

我正在尝试将我的cvs存储库转换为git并且暂时停留在最后一个问题上.

我目前使用CVS&符号模块在projets之间共享代码.这些允许您基本上将另一个存储库"别名"作为项目中的子目录,因此您可以更新/提交整个项目,并且它包含远程存储库,就像它是一个存储库一样.

我已经看过线程推荐使用子树合并或子模块来执行此操作,参考(svn:externals).这不起作用,因为:

  • 子树合并显然不允许您轻松推回/更新外部回购.

  • 子模块仍然需要您手动推/拉每个子模块.我有大量的子模块,并且每个子模块都会推送我的更改会很乏味,并且可能会导致遗漏,因为更改会忘记提交.

为了清楚起见,我希望有一个git存储库,其中包含其他git存储库作为子目录,并且能够使用一个命令同时提交/推送/拉到所有这些存储库.

git cvs

5
推荐指数
1
解决办法
606
查看次数

不具备n-ary功能

我有一个类型级别的数字

data Z   deriving Typeable
data S n deriving Typeable
Run Code Online (Sandbox Code Playgroud)

和n-ary函数(来自固定向量包的代码)

-- | Type family for n-ary functions.
type family   Fn n a b
type instance Fn Z     a b = b
type instance Fn (S n) a b = a -> Fn n a b

-- | Newtype wrapper which is used to make 'Fn' injective. It's also a
--   reader monad.
newtype Fun n a b = Fun { unFun :: Fn n a b }
Run Code Online (Sandbox Code Playgroud)

我需要像这样的功能

uncurryN …
Run Code Online (Sandbox Code Playgroud)

haskell ghc type-families

5
推荐指数
1
解决办法
437
查看次数

helloworld.c无法编译100多个错误

我相信我正在处理某种被破坏的库.我写了以下代码:

//helloworld.c                                                                  

#include <stdio.h>

int main()
{
  printf("Hello, world!\n");

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

并使用以下命令编译它:

gcc helloworld.c
Run Code Online (Sandbox Code Playgroud)

我得到的错误很多.这是一个示例:

/usr/include/stdio.h:510: error: expected ‘)’ before ‘*’ token
/usr/include/stdio.h:514: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__wur’
/usr/include/stdio.h:517: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__THROW’
/usr/include/stdio.h:524: error: expected declaration specifiers before ‘__END_NAMESPACE_C99’
/usr/include/stdio.h:534: error: expected ‘)’ before ‘*’ token
/usr/include/stdio.h:540: error: storage class specified for parameter ‘getchar’
/usr/include/stdio.h:541: error: expected declaration specifiers before ‘__END_NAMESPACE_STD’
/usr/include/stdio.h:553: error: storage class specified for …
Run Code Online (Sandbox Code Playgroud)

c configuration ubuntu-11.10

4
推荐指数
1
解决办法
2247
查看次数

C程序中变量的地址

#include <stdio.h>

main()
{
    int i = 5;
    printf("%d \n" , &i);
}
Run Code Online (Sandbox Code Playgroud)

重复执行上述程序会导致变量的地址不同i吗?

c

3
推荐指数
1
解决办法
200
查看次数

如何在.emacs中创建特定的窗口设置

我对emacs和Lisp还是很陌生,尽管从使用其他功能语言的经验来看,我很难模仿有用的代码片段中看到的内容。我在.emacs文件中添加了一些不错的窗口切换功能,它们运行良好。

但是在启动时,我想配置特定的窗口/框架排列。基本上,我想在每次启动emacs时执行以下操作(通常每天最多一次,然后将其打开几天/几周)。

1. Split the screen in half (C-x 2)
2. Grow the top half bigger by 20 lines (C-u 20 C-x ^)
3. Open a second frame of emacs (C-x 5 2)
Run Code Online (Sandbox Code Playgroud)

理想情况下,我什至希望最大化左显示器上的第一帧和右显示器上的第二帧,但是我可以做到这一点。

我只是想知道如何将等效于键盘命令的功能写入.emacs文件。

emacs startup key-bindings

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

将va_arg两次传递给相同值的函数结果

我正在尝试使用va_arg在我的GUI库中创建一个通用工厂函数.在同一函数中传递va_arg两次时,它们传递相同的值而不是两个不同的值:

GUIObject* factory(enumGUIType type, GUIObject* parent, ...){
   va_list vl;
   va_start(vl, parent);
   ...
   label->SetPosition(va_arg(vl, int), va_arg(vl, int));
   va_end(vl);
   return finalObjectPointer;
}

factory(LABEL, theParent, 100,200); // Results in position 200:200
Run Code Online (Sandbox Code Playgroud)

是什么导致了这种意外行为

c++ variadic-functions

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