URL rewrites & Drupal functions
If you are running Drupal in subdirectory named "dev". Then you need to put $base_url = 'http://www.example.com' in your settings.php. You may need to put RewriteBase /dev in your .htaccess but generally that isn't necessary for me.

If you want to run Drupal at http://dev.example.com that is purely an issue of configuring Apache correctly. Your likely need to change your httpd.conf or similar file to setup virtual hosting. Drupal won't need any changes.