Compiler Developer (LLVM, C++)
Systems, C++ and performancePosted over 2 months agovia Himalayas, a remote job board
- Work type
- RemoteOpen worldwide
- Experience
- Not stated
- Pay
- Not listed
- Posted
- Over 2 months agoOpen 2 months
Skills it mentions
Add your skills to see which ones you have.
About the job
As a member of the toolchain team, you will:
- analyze the requirements, research, design, enhance and implement different components of the toolchain to meet the clients needs;
- extend the open source LLVM, Clang, binutils code bases to support the client's platform;
- closely collaborate with the LLVM community and contribute public patches to the LLVM and Clang repository;
- analyze, build and debug the platform code and platform specific tests, analyze and identify system level issues;
- develop new and maintain the existing target specific tests.
Required qualifications:
- expert knowledge of C/C++;
- experience in overall design of compilers, code generation and optimization;
- cross-compilation using GCC or Clang;
- in-depth understanding of multithreading, object-oriented analysis and design;
- version control systems;
- good self-motivation, ability to work independently;
- strong track record of building high performance, production quality software;
- passion for writing clean and effective code;
- good English, strong communication and teamwork skills.
Nice to have qualifications:
- knowledge of the C++11 / C++14/C++17 features;
- knowledge of assemblers, linkers, object file formats, debuggers and experience using them;
- familiarity with *nix tools, CMake, make;
- scripting languages such as Python and bash.
Our benefits:
- Work from anywhere in the world!
- Flexible working hours
- Experienced development teams
- Long-term employment
- Competitive salary
- Paid vacation and days off on national holidays
- Paid sick leave and internal medical insurance policy
- Mental health coverage
- Global corporate events for all staff
- Compensation for training and additional education
- Community of practice, regular knowledge sharing among colleagues
- Provision of computer equipment
- Internet compensation (50$ per month)
- Relocation compensation package to be discussed individually
- And other benefits, described in detail in the Staff Handbook
Originally posted on Himalayas
Interested?Compiler Developer (LLVM, C++) at Access Softek
Apply on Himalayas (opens in a new tab)The job ad ends here
Interview questions for this job6 with answers, on C++, C, Python and 1 more
Interview questions for this job
For the skills the ad mentions: C++, C, Python and Shell scripting.
When should static_cast, dynamic_cast, const_cast, and reinterpret_cast be used?C++
static_caststatic_castis the first cast you should attempt to use. It does things like implicit conversions between types (such asinttofloat, or pointer tovoid*), and it can also call explicit conversion functions (or implicit ones). In many cases, explicitly statingstatic_castisn't necessary, but it's important to note that theT(something)syntax is equivalent to(T)somethingand should be avoided (more on that later). AT(something, something_else)is safe, however, and guaranteed to call the constructor.static_castcan also cast through inheritance hierarchies. It is unnecessary when casting upwards (towards a base class), but when casting downwards it can be used as long as it doesn't cast throughvirtualinheritance. It does not do checking, however, and it is undefined behavior tostatic_castdown a hierarchy to a type that isn't actually the type of the object.const_castconst_castcan be used to remove or addconstto a variable; no other C++ cast is capable of removing it (not evenreinterpret_cast). It is important to note that modifying a formerlyconstvalue is only undefined if the original variable isconst; if you use it to take theconstoff a reference to something that wasn't declared withconst, it is safe. This can be useful when overloading member functions based onconst, for instance. It can also be used to addconstto an object, such as to call a member function overload.const_castalso works similarly onvolatile, though that's less common.dynamic_castdynamic_castis exclusively used for handling polymorphism. You can cast a pointer or reference to any polymorphic type to any other class type (a polymorphic type has at least one virtual function, declared or inherited). You can use it for more than just casting downwards – you can cast sideways or even up another chain. Thedynamic_castwill seek out the desired object and return it if possible. If it can't, it will returnnullptrin the case of a pointer, or throwstd::bad_castin the case of a reference.dynamic_casthas some limitations, though. It doesn't work if there are multiple objects of the same type in the inheritance hierarchy (the so-called 'dreaded diamond') and you aren't usingvirtualinheritance. It also can only go through public inheritance - it will always fail to travel throughprotectedorprivateinheritance. This is rarely an issue, however, as such forms of inheritance are rare.reinterpret_castreinterpret_castis the most dangerous cast, and should be used very sparingly. It turns one type directly into another — such as casting the value from one pointer to another, or storing a pointer in anint, or all sorts of other nasty things. Largely, the only guarantee you get withreinterpret_castis that normally if you cast the result back to the original type, you will get the exact same value (but not if the intermediate type is smaller than the original type). There are a number of conversions thatreinterpret_castcannot do, too. It's often abused for particularly weird conversions and bit manipulations, like turning a raw data stream into actual data, or storing data in the low bits of a pointer to aligned data. For those cases, seestd::bit_cast.C-Style Cast and Function-Style Cast
C-style cast and function-style cast are casts using
(type)objectortype(object), respectively, and are functionally equivalent. They are defined as the first of the following which succeeds:const_caststatic_cast(though ignoring access restrictions)static_cast(see above), thenconst_castreinterpret_castreinterpret_cast, thenconst_cast
Read the rest at the sourceFrom Stack Overflow: asked by James Eichele, answered by coppro (CC BY-SA 4.0)
What is the strict aliasing rule?C
A typical situation where you encounter strict aliasing problems is when overlaying a struct (like a device/network message) onto a buffer of the word size of your system (like a pointer to
uint32_ts oruint16_ts). When you overlay a struct onto such a buffer, or a buffer onto such a struct through pointer casting you can easily violate strict aliasing rules.So in this kind of setup, if I want to send a message to something I'd have to have two incompatible pointers pointing to the same chunk of memory. I might then naively code something like this:
#include <stdint.h> #include <stdlib.h> #include <stdio.h> typedef struct Msg { uint32_t a; uint32_t b; } Msg; // Sends a buffer over a 16-bit channel void SendWords(uint16_t *buf, size_t sz) { for(size_t i = 0; i < sz; ++i) printf("%.4x ", buf[i]); printf("\n"); } int main(void) { Msg msg; // Send a bunch of messages for(int i = 0; i < 10; ++i) { msg.a = 0xDEADBEEF; msg.b = i; SendWords((uint16_t*)&msg, sizeof(msg)/sizeof(uint16_t)); } }The strict aliasing rule makes this setup illegal: dereferencing a pointer that aliases an object that is not of a compatible type or one of the other types allowed by C 2011 6.5 paragraph 71 is undefined behavior. Unfortunately, you can still code this way, maybe get some warnings, have it compile fine, only to have weird unexpected behavior when you run the code. For example, when I compiled it with
gcc -O2it produced this very unexpected output:0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 ...See this snippet on Compiler Explorer for how GCC and Clang both produce different unintended outputs.
To see why this behavior is undefined, we have to think about what the strict aliasing rule buys the compiler. Following this rule, the writes to
msgcannot alias the reads ofbufinSendWords. Consequently, an optimizing compiler can reorder the instructions, so that all assignments tomsghappen before or after all the reads frombufinSendWords. In turn, it can then deduce thatbuf[0], ..., buf[3]can be loaded from memory before the loop is executed, or that only themsgvalues from the last iteration of the loop need to be calculated. Either way, removing the redundant stores and loads (under this rule) makes the generated code faster. Before strict aliasing was introduced, the compiler had to live in a state of paranoia that the contents ofbufcould change by any preceding memory stores. So to get an extra performance edge, and assuming most people don't type-pun pointers, the strict aliasing rule was introduced.So how do I get around this?
Read the rest at the sourceFrom Stack Overflow: asked by Benoit, answered by Doug T. (CC BY-SA 4.0)
How do I check whether a file exists without exceptions?Python
If the reason you're checking is so you can do something like
if file_exists: open_it(), it's safer to use atryaround the attempt to open it. Checking and then opening risks the file being deleted or moved or something between when you check and when you try to open it.If you're not planning to open the file immediately, you can use
os.path.isfileif you need to be sure it's a file.Return
Trueif path is an existing regular file. This follows symbolic links, so both islink() and isfile() can be true for the same path.import os.path os.path.isfile(fname)pathlibStarting with Python 3.4, the
pathlibmodule offers an object-oriented approach (backported topathlib2in Python 2.7):from pathlib import Path my_file = Path("/path/to/file") if my_file.is_file(): # file existsTo check a directory, do:
if my_file.is_dir(): # directory existsTo check whether a
Pathobject exists independently of whether is it a file or directory, useexists():if my_file.exists(): # path existsYou can also use
resolve(strict=True)in atryblock:try: my_abs_path = my_file.resolve(strict=True) except FileNotFoundError: # doesn't exist else: # existsFrom Stack Overflow: asked by spence91, answered by rslite (CC BY-SA 4.0)
How can I get my external IP address in a shell script?Shell scripting
I'd recommend getting it directly from a DNS server.
Most of the other answers below all involve going over HTTP to a remote server. Some of them required parsing of the output, or relied on the User-Agent header to make the server respond in plain text. Those change quite frequently (go down, change their name, put up ads, might change output format etc.).
- The DNS response protocol is standardised (the format will stay compatible).
- Historically, DNS services (Akamai, Google Public DNS, OpenDNS, ..) tend to survive much longer and are more stable, more scalable, and generally more looked-after than whatever new hip whatismyip dot-com HTTP service is hot today.
- This method is inherently faster (be it only by a few milliseconds!).
Using
digwith an OpenDNS resolver:$ dig @resolver4.opendns.com myip.opendns.com +shortPerhaps alias it in your
bashrcso it's easy to remember# https://unix.stackexchange.com/a/81699/37512 alias wanip='dig @resolver4.opendns.com myip.opendns.com +short' alias wanip4='dig @resolver4.opendns.com myip.opendns.com +short -4' alias wanip6='dig @resolver1.ipv6-sandbox.opendns.com AAAA myip.opendns.com +short -6'Responds with a plain ip address:
$ wanip # wanip4, or wanip6 80.100.192.168 # or, 2606:4700:4700::1111How it works
The dig command.
(Abbreviated from https://ss64.com/bash/dig.html. You can read this anytime via
man dig):usage: dig [@global-dnsserver] [q-type] <hostname> <d-opt> [q-opt] q-type one of (A, ANY, AAAA, TXT, MX, ...). Default: A. d-opt ... +[no]short (Display nothing except short form of answer) ... q-opt one of: -4 (use IPv4 query transport only) -6 (use IPv6 query transport only) ...The
ANYquery type returns either an AAAA or an A record. To prefer IPv4 or IPv6 connection specifically, use the-4or-6options accordingly.To require the response be an IPv4 address, replace ANY with
A; for IPv6, replace it withAAAA. Note that it can only return the address used for the connection. For example, when connecting over IPv6, it cannot return the A address.Alternative servers
Various DNS providers offer this service, including OpenDNS, Akamai, and Google Public DNS:
# OpenDNS (since 2009) $ dig @resolver3.opendns.com myip.opendns.com +short $ dig @resolver4.opendns.com myip.opendns.com +short 80.100.192.168 # OpenDNS IPv6 $ dig @resolver1.ipv6-sandbox.opendns.com AAAA myip.opendns.com +short -6 2606:4700:4700::1111 # Akamai (since 2009) $ dig @ns1-1.akamaitech.net ANY whoami.akamai.net +short 80.100.192.168 # Akamai approximate # NOTE: This returns only an approximate IP from your block, # but has the benefit of working even when behind private DNS proxies. $ dig +short TXT whoami.ds.akahelp.net "ip" "80.100.192.160" # Google (since 2010) # Supports IPv6 + IPv4, use -4 or -6 to force one. $ dig @ns1.google.com TXT o-o.myaddr.l.google.com +short "80.100.192.168"Example alias that specifically requests an IPv4 address:
# https://unix.stackexchange.com/a/81699/37512 alias wanip4='dig @resolver4.opendns.com myip.opendns.com +short -4' $ wanip4 80.100.192.168And for your IPv6 address:
# https://unix.stackexchange.com/a/81699/37512 alias wanip6='dig @ns1.google.com TXT o-o.myaddr.l.google.com +short -6' $ wanip6 "2606:4700:4700::1111"Troubleshooting
Read the rest at the sourceFrom Unix & Linux Stack Exchange: asked by Eugene Yarmash, answered by Timo Tijhof (CC BY-SA 4.0)
What's the problem with "using namespace std;"?C++
Consider two libraries called Foo and Bar:
using namespace foo; using namespace bar;Everything works fine, and you can call
Blah()from Foo andQuux()from Bar without problems. But one day you upgrade to a new version of Foo 2.0, which now offers a function calledQuux(). Now you've got a conflict: Both Foo 2.0 and Bar importQuux()into your global namespace. This is going to take some effort to fix, especially if the function parameters happen to match.If you had used
foo::Blah()andbar::Quux(), then the introduction offoo::Quux()would have been a non-event.From Stack Overflow: asked by akbiggs, answered by Greg Hewgill (CC BY-SA 4.0)
Why did you leave your last job?Behavioural
The employer may ask you questions about leaving your last job.
If you've been out of work for a long time, explain why. Talk about the positive things you've done while away from work. For example, networking, retraining, volunteering or keeping fit.
If you:
- left by choice: be positive about why you want a new job and describe why their company suits you better
- got made redundant: explain the situation, be positive and describe how you've responded since
- were fired for misconduct or poor performance: explain why your standards dropped, what you've learned and how you've improved since the experience
From National Careers Service: interview advice (Open Government Licence v3.0)