asan13

Untitled

Oct 13th, 2017
588
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import std.stdio;
  2. import std.algorithm.searching : find;
  3. import std.concurrency;
  4. import core.atomic;
  5.  
  6. shared int x;
  7.  
  8. int main(string[] argv)
  9. {
  10.     x += 1;   // здесь варнинг
  11.     writeln(x);
  12.  
  13.     atomicOp!"+="(x, 10);
  14.     writeln(x);
  15.  
  16.     return 0;
  17. }
  18.  
  19. /*
  20. Performing "debug" build using dmd for x86_64.
  21. test ~master: building configuration "application"...
  22. source/app.d(10,5): Deprecation: read-modify-write operations are not allowed for shared variables. Use core.atomic.atomicOp!"+="(x, 1) instead.
  23. Linking...
  24. Running ./test
  25. 1
  26. 11
  27. */
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×