unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* c++-mode: Invalid function: (setq ad-return-value (ad-Orig-c-parse-state))
@ 2013-03-26 20:12 Andrew Pennebaker
  2013-03-26 20:18 ` Andrew Pennebaker
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Andrew Pennebaker @ 2013-03-26 20:12 UTC (permalink / raw)
  To: Emacs Help


[-- Attachment #1.1: Type: text/plain, Size: 288 bytes --]

I can't insert important C++ characters into my code (attached). When I
press ; or { Emacs shows an error in the minibuffer:

"Invalid function: (setq ad-return-value (ad-Orig-c-parse-state))"

Major mode is c++-mode.

Using Emacs 24.2.1.

-- 
Cheers,

Andrew Pennebaker
www.yellosoft.us

[-- Attachment #1.2: Type: text/html, Size: 560 bytes --]

[-- Attachment #2: fizzy.cpp --]
[-- Type: text/x-c++src, Size: 1073 bytes --]

#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <numeric>

#ifdef ASYNC
#include <future>
#endif

using namespace std;

string fizzy(int n) {
  int a = n % 3, b = n % 5;

  if (a == 0 && b == 0) {
    return "FizzBuzz";
  }
  else if (a == 0) {
    return "Fizz";
  }
  else if (b == 0) {
    return "Buzz";
  }
  else {
    stringstream out;
    out << n;
    return out.str();
  }
}

void fizzbuzz() {
  vector<int> range(100, 0);

#ifdef ASYNC
  iota(range.begin(), range.end(), 0);
#endif

  vector<string> strings(range.size(), "");

#ifdef ASYNC
  vector<future<void>> futures;
#endif

#ifdef AUTO
  for (auto i : range) {
#elsif
  int i;
  for (i = 0; i < range.size(); i++) {
#endif
#ifdef ASYNC
    futures.emplace_back(
      std::async(
        launch::async,
        [&]() {
#endif
          strings[i] = fizzy(i + 1);

#ifdef ASYNC
        }
      )
    );
#endif
  }

  for (auto s : strings) {
    cout << s << endl;
  }
}

int main() { fizzbuzz(); }

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-03-27 12:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-26 20:12 c++-mode: Invalid function: (setq ad-return-value (ad-Orig-c-parse-state)) Andrew Pennebaker
2013-03-26 20:18 ` Andrew Pennebaker
2013-03-27  6:43 ` Leo Liu
2013-03-27 12:16   ` Andrew Pennebaker
     [not found] ` <mailman.22894.1364329129.855.help-gnu-emacs@gnu.org>
2013-03-27 11:07   ` c++-mode: Invalid function: (setq ad-return-value?(ad-Orig-c-parse-state)) Alan Mackenzie
2013-03-27 12:37 ` c++-mode: Invalid function: (setq ad-return-value (ad-Orig-c-parse-state)) Stefan Monnier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).