小编Shi*_*oko的帖子

用于检查C/C++代码约定的自动工具

我们让学生在课程中提交练习,同时他们必须遵守一些代码约定.例如,函数名称应该在camelCase中.函数长度不应超过50行(任务很简单,可以划分)等等.我正在寻找一种可以自动检查C/C++(两者都需要)的工具.也就是说,我希望该工具在出现问题时进行投诉,以便学生能够解决问题.到目前为止,我一直无法找到合适的东西.如果这个东西是开源的,可以很容易地根据我们的需求进行配置

c c++ automation coding-style naming-conventions

12
推荐指数
1
解决办法
6343
查看次数

这些线路是否在无锁队列中是不必要的?

以下是使用compareAndSet(在Java中)的无锁队列中的一些代码:

public void enq(T value) {
    Node newNode = new Node(value);
    while(true) {
        Node last = tail.get();
        Node next = last.next.get();

        if(last != tail.get())
            continue;   //???       

        if (next != null) { //improve tail
            tail.compareAndSet(last, next);
            continue;
        }

        if (last.next.compareAndSet(null, newNode)) {   //update last node
            tail.compareAndSet(last, newNode);  //update tail
            return;
        }
    }
}

public T deq() throws EmptyException {
    while(true) {
        Node first = head.get();
        Node last = tail.get();
        Node next = first.next.get();

        if(first != head.get())
            continue;   //???

        if(first == last) …
Run Code Online (Sandbox Code Playgroud)

java multithreading lock-free

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